- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Get latest response with export_responses_by_token() API function
- SybrenR
- Topic Author
- Offline
- New Member
Less
More
7 years 5 months ago #144938
by SybrenR
Get latest response with export_responses_by_token() API function was created by SybrenR
As a new feature for our existing survey, we want some users to be able to fill in a survey again.
To do this, we set 'completed' back to 'N' and 'uses left' to 1, so the user can use the same token again to fill out the survey.
This results in 2 complete responses to the survey.
When using the API to retrieve the answers, the only data that comes in is the first reponse, even though we are only interested in the newer answers. This can be bypassed by setting the first reponse to completed='NO', but I think there should be a better way to allways download the most recent response for a token.
Does anybody know how I can achieve this? Thanks in advance!
To do this, we set 'completed' back to 'N' and 'uses left' to 1, so the user can use the same token again to fill out the survey.
This results in 2 complete responses to the survey.
When using the API to retrieve the answers, the only data that comes in is the first reponse, even though we are only interested in the newer answers. This can be bypassed by setting the first reponse to completed='NO', but I think there should be a better way to allways download the most recent response for a token.
Does anybody know how I can achieve this? Thanks in advance!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
7 years 4 months ago - 7 years 4 months ago #145100
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Get latest response with export_responses_by_token() API function
Just a question, why not set uses left to 10000 directly ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 7 years 4 months ago by DenisChenu. Reason: typo
The topic has been locked.
- SybrenR
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
7 years 4 months ago #145169
by SybrenR
Replied by SybrenR on topic Get latest response with export_responses_by_token() API function
In general we only want users to fill in the survey twice. They have to fill in details about their energy meter, solar panels etc, so we don't want them to fill it in again unless we want to have the information updated.
The problem remains: Unless I manually set the first response to 'incomplete', only the first set of answers will be returned and not the most recent.
The problem remains: Unless I manually set the first response to 'incomplete', only the first set of answers will be returned and not the most recent.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
7 years 4 months ago #145248
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Get latest response with export_responses_by_token() API function
OK, got it.
Seems to be OK in code : github.com/LimeSurvey/LimeSurvey/blob/ma...rol_handle.php#L2523
When you browse response : there are one or two answers ?
Because if you 'Enable token-based response persistence' i think you have only one answer in response table.
Denis
Seems to be OK in code : github.com/LimeSurvey/LimeSurvey/blob/ma...rol_handle.php#L2523
When you browse response : there are one or two answers ?
Because if you 'Enable token-based response persistence' i think you have only one answer in response table.
Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.