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
  • torilee93's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 9 months ago #218105 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
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago #218111 by holch
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.

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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago #218115 by tpartner
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
  • torilee93's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 9 months ago #218148 by torilee93
Thanks @holch
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
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago - 2 years 9 months ago #218149 by holch
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.

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.
More
2 years 9 months ago #218442 by abbasi1
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.

Lime-years ahead

Online-surveys for every purse and purpose