- Posts: 56
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Is there a way to have a survey prefill with the answers of another survey?
- torilee93
- Topic Author
- Offline
- Senior Member
Less
More
2 years 9 months ago #218105
by torilee93
Is there a way to have a survey prefill with the answers of another survey? was created by torilee93
Hello,
I have two surveys and was wondering if limesurvey has an option to grab some of the answers from survey 1 and populate them into survey 2. These are both token based surveys.
Thanks for your time!
- Tori
I have two surveys and was wondering if limesurvey has an option to grab some of the answers from survey 1 and populate them into survey 2. These are both token based surveys.
Thanks for your time!
- Tori
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11656
- Thank you received: 2742
2 years 9 months ago #218111
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Is there a way to have a survey prefill with the answers of another survey?
Well, yes and no.
With Limesurvey you can't access data from another survey (or even from the same survey but for a different response line.
However, what you can do is include the answers from survey one into the token table of survey two into custom attributes of the token table, when you create it and then use expression script to access the values from the token table and pipe them into the survey.
With Limesurvey you can't access data from another survey (or even from the same survey but for a different response line.
However, what you can do is include the answers from survey one into the token table of survey two into custom attributes of the token table, when you create it and then use expression script to access the values from the token table and pipe them into the survey.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: torilee93
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
2 years 9 months ago #218115
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Is there a way to have a survey prefill with the answers of another survey?
Or and AJAX call to the API.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: holch
The topic has been locked.
- torilee93
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 56
- Thank you received: 0
2 years 9 months ago #218148
by torilee93
Replied by torilee93 on topic Is there a way to have a survey prefill with the answers of another survey?
Thanks @holch
Is there a manual on how to include the answers from one survey to another and using expression scripts?
- Tori
Is there a manual on how to include the answers from one survey to another and using expression scripts?
- Tori
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11656
- Thank you received: 2742
2 years 9 months ago - 2 years 9 months ago #218149
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Is there a way to have a survey prefill with the answers of another survey?
Here a couple of links to the manual:
manual.limesurvey.org/Survey_participants
And more specifically attributes: manual.limesurvey.org/Survey_participants#Manage_attributes
manual.limesurvey.org/Expression_Manager
And more specifically manual.limesurvey.org/Expression_Manager#Tailoring.2FPiping
So basically you run survey 1. Let's assume you ask for the gender of this person. For the next survey you don't want to ask that anymore, but rather just ask them to confirm if the data you have is correct.
So for survey 2 you create a token table with a custom attribute for the gender. let's assume this attribute is attribute_1.
Then you can access the data stored in this custom token attribute with something like {TOKEN:attribute_1}. (I haven't checked if this is the exact syntax, you will need to read about this in the manual and test it, it is just an example of how it works)
So you could for example as in a question:
"In our records with have the information that you are male. Is this correct? (yes/no).
But of course you could even just pass this information into a hidden question, etc. There are a lot of possibilities.
However, you will need to create the new token table for survey 2 with the information collected in survey 1 manually.
As Tpartner suggested, if you want to automate this, you could also make an Ajax call. You still will need to create a token table, but you don't need to create custom attributes and fill the these with the information collected from survey 1. But creating this token table from the data collected in survey 1 is not that much work either. If you run this only once, it is probably the same as creating the ajax script.
manual.limesurvey.org/Survey_participants
And more specifically attributes: manual.limesurvey.org/Survey_participants#Manage_attributes
manual.limesurvey.org/Expression_Manager
And more specifically manual.limesurvey.org/Expression_Manager#Tailoring.2FPiping
So basically you run survey 1. Let's assume you ask for the gender of this person. For the next survey you don't want to ask that anymore, but rather just ask them to confirm if the data you have is correct.
So for survey 2 you create a token table with a custom attribute for the gender. let's assume this attribute is attribute_1.
Then you can access the data stored in this custom token attribute with something like {TOKEN:attribute_1}. (I haven't checked if this is the exact syntax, you will need to read about this in the manual and test it, it is just an example of how it works)
So you could for example as in a question:
"In our records with have the information that you are male. Is this correct? (yes/no).
But of course you could even just pass this information into a hidden question, etc. There are a lot of possibilities.
However, you will need to create the new token table for survey 2 with the information collected in survey 1 manually.
As Tpartner suggested, if you want to automate this, you could also make an Ajax call. You still will need to create a token table, but you don't need to create custom attributes and fill the these with the information collected from survey 1. But creating this token table from the data collected in survey 1 is not that much work either. If you run this only once, it is probably the same as creating the ajax script.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 2 years 9 months ago by holch.
The topic has been locked.
- abbasi1
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
2 years 9 months ago #218442
by abbasi1
Replied by abbasi1 on topic Is there a way to have a survey prefill with the answers of another survey?
Well, it's possible... you can load a response using the token and surveyId and used javascript to load this response into the fields. I worked on such a plugin where I loaded the response of a previous plugin into the hidden fields in the current survey.
The topic has been locked.