- Posts: 44
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to pass array answers from one survey to another?
- SherriChen
- Topic Author
- Offline
- Senior Member
Less
More
4 years 8 months ago #187308
by SherriChen
How to pass array answers from one survey to another? was created by SherriChen
Hi,
My survey is too long to be activated, so I divided it into Survey 1 and Survey 2 and connect them with End URL. But some questions in Survey 2 need to use the answers of array questions in Survey 1. I searched online and found it is possible to pass answers through URL. Although I read manual.limesurvey.org/URL_fields#End_URL_field , I still confused about how to pass answers of an array question in Survey 1 to Survey 2. I attached two sample surveys, each of them contains one same question(A2). Could someone help me to pass the answer of A2 in Survey 1 to Survey 2? Thank you!
My survey is too long to be activated, so I divided it into Survey 1 and Survey 2 and connect them with End URL. But some questions in Survey 2 need to use the answers of array questions in Survey 1. I searched online and found it is possible to pass answers through URL. Although I read manual.limesurvey.org/URL_fields#End_URL_field , I still confused about how to pass answers of an array question in Survey 1 to Survey 2. I attached two sample surveys, each of them contains one same question(A2). Could someone help me to pass the answer of A2 in Survey 1 to Survey 2? Thank you!
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12886
- Thank you received: 3965
4 years 8 months ago - 4 years 8 months ago #187326
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to pass array answers from one survey to another?
Hi,
you obviously don't want to ask the same question again.
Your question is how to build the end-url and how to capture the parameters in the second survey.
1. end-url:
You have to add the parameters to the URL, separated by "&".
Here I named the parameters V11,V12,V13,V14,V21,V22,...
And you will get an end-url like:
2, Capturing
In your second survey you use "panel integration".
For each parameter I used a question of type "short text" (pV11,pV12,pV12,...)
and I get the parameters back in these questions.
To enter the values back into the array use an equation like: (what I think is not done in your survey).
{A2_SQ001_SQ001=pV11}
{A2_SQ001_SQ002=pV12}
{A2_SQ001_SQ003=pV13}
...
{A2_SQ002_SQ002=pV22}
...
Okay, but there is a length limit of an url.
Read here
boutell.com/newfaq/misc/urllength.html
BTW: hat for is the hard coded text in the address field. Can't you implement it as a placeholder?
Joffm
And do not forget to add the SAVEDID to the end-url as well. And capture it in the second.
Otherwise you have no chance to merge the surveys
you obviously don't want to ask the same question again.
Your question is how to build the end-url and how to capture the parameters in the second survey.
1. end-url:
You have to add the parameters to the URL, separated by "&".
Here I named the parameters V11,V12,V13,V14,V21,V22,...
Code:
https://www.myServer.de/survey/index.php/693311?newtest=Y&V11={A2_SQ001_SQ001}&V12={A2_SQ001_SQ002}&V13={A2_SQ001_SQ003}&V14={A2_SQ001_SQ004}&V21={A2_SQ002_SQ001}
And you will get an end-url like:
Code:
https://www.myServer.de/survey/index.php/693311?newtest=Y&V11=Date of birth&V12=2010-04&V13=Street, neighborhood or building: Vischerstraat 23 City: Nijmegen Country: NL Postcode: 1234 AB&V14=Apartment&V21=End time of Home 1
2, Capturing
In your second survey you use "panel integration".
For each parameter I used a question of type "short text" (pV11,pV12,pV12,...)
and I get the parameters back in these questions.
To enter the values back into the array use an equation like: (what I think is not done in your survey).
{A2_SQ001_SQ001=pV11}
{A2_SQ001_SQ002=pV12}
{A2_SQ001_SQ003=pV13}
...
{A2_SQ002_SQ002=pV22}
...
Okay, but there is a length limit of an url.
Read here
boutell.com/newfaq/misc/urllength.html
BTW: hat for is the hard coded text in the address field. Can't you implement it as a placeholder?
Joffm
And do not forget to add the SAVEDID to the end-url as well. And capture it in the second.
Otherwise you have no chance to merge the surveys
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 8 months ago by Joffm.
The topic has been locked.
- SherriChen
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 44
- Thank you received: 0
4 years 8 months ago #187345
by SherriChen
Replied by SherriChen on topic How to pass array answers from one survey to another?
Thank you very much, Joffm! I understand! Very clear explanation!
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
4 years 8 months ago #187347
by jelo
Small reminder: Not all content can by transferred via URL without URLencoding/deconding of text. There are characters which will break the URL browser or serverside.
Another reminder: URLdata might be cached and logged somewhere. So data from the survey might stays in thirdparty systems (e.g. logfiles).
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic How to pass array answers from one survey to another?
Joffm wrote: And you will get an end-url like:
Code:https://www.myServer.de/survey/index.php/693311?newtest=Y&V11=Date of birth&V12=2010-04&V13=Street, neighborhood or building: Vischerstraat 23 City: Nijmegen Country: NL Postcode: 1234 AB&V14=Apartment&V21=End time of Home 1
Small reminder: Not all content can by transferred via URL without URLencoding/deconding of text. There are characters which will break the URL browser or serverside.
Another reminder: URLdata might be cached and logged somewhere. So data from the survey might stays in thirdparty systems (e.g. logfiles).
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- SherriChen
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 44
- Thank you received: 0
4 years 8 months ago #187348
by SherriChen
Replied by SherriChen on topic How to pass array answers from one survey to another?
Thank you. I will pay attention to this issue.
The topic has been locked.