Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Pass selected answer into another survey

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago - 2 years 9 months ago #225969 by dcspinho
Hello. I divided my survey into several parts because it's to large to activate.
How can I pass the selected answers in a determinated group to the next survey?
The selected group has suboptions answers.
Q1. This is the question?
   A1. First answer.
   A2. Second answer.
Here I want the selected answers in the A* and pass them into the second survey.
Last edit: 2 years 9 months ago by dcspinho.

Please Log in to join the conversation.

More
2 years 9 months ago #225974 by jelo
Replied by jelo on topic Pass selected answer into another survey
You can pass information via URL into a survey. You need to think about how to transfer answers into URLcompatible content. Somestimes it's easy and you only have a few numbers. But if it comes to written text in nonenglish character encoding it can become hard.

Read the manual here and experiment a bit.
www.limesurvey.org/manual/URL_fields/

 

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago - 2 years 9 months ago #225998 by dcspinho
Replied by dcspinho on topic Pass selected answer into another survey
The content of the link manual.limesurvey.org/URL_fields/ isn't written yet.

I don't know if I expressed myself in the correct way.
I want to pass the id of the selected answer (sub option answer) to the 2nd survey to trigger other questions in the 2nd survey.

I understood that I can use something like this www.example.com/index.php/survey/index/sid/712544/newtest/Y ? and add the ids that I want after the interrogation point.

It will be something like this (I guess) www.example.com/index.php/survey/index/s...t/Y?AID=1,3,5,6,7,50

I tryid but I don't know how I can get this values from the survey to add them in this END URL.
 
Last edit: 2 years 9 months ago by dcspinho.

Please Log in to join the conversation.

More
2 years 9 months ago #226001 by jelo
Replied by jelo on topic Pass selected answer into another survey
Mhm. Try the URL without a / at the end. I see content in English.
www.limesurvey.org/manual/URL_fields
You can search inside the manual to find content about URL fields too.

There are no questions objects to assign to variables to get them into the URL.
You will need to write you own code in ExpressionScript to assign values to variables. And you need to write your own code to assess the variables in the desitination survey.

If you have a singlechoice question, you have the answer inside the {questioncode}. So you can simply add that to the endURL &myvar={questioncode} and add myvar to the destination survey via panel integration and create a hidden question to save the content of myvar in the destination survey. If you have more complex question-types, you have to do more complex scripting to get the data across.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago #226012 by dcspinho
Replied by dcspinho on topic Pass selected answer into another survey
Thanks. I can see the content without the / .

The questions are multy choice with comments. I will try.

Please Log in to join the conversation.

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago - 2 years 9 months ago #226039 by dcspinho
Replied by dcspinho on topic Pass selected answer into another survey
I know how to pass the questions ID between surveys, but I can't activate/show the questions in the second survey based in the URL field.

Is it possible to activate/show some questions in the second survey based in the answers in the first survey?
Last edit: 2 years 9 months ago by dcspinho.

Please Log in to join the conversation.

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago #226043 by dcspinho
Replied by dcspinho on topic Pass selected answer into another survey
p.s. The question is multichoise with comment in the second survey.
I saw that with short text I can do it in the Panel Integration.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago #226045 by Joffm
Replied by Joffm on topic Pass selected answer into another survey
Hi,
taking your example "?AID=1,3,5,6,7,50"
you have a question of type "short text" called "AID" that contains a string "1,3,5,6,7,50".
At the moment only you know what it means.

But in your second survey you may use this string to show/hide/pipe everything you want

Let's have an example.
In the first survey there is a array question (Q1) where 6 brands are rated (1-5)
In your second survey you want to display in amultiple question only the brands rated 4 or 5.
So I would create the parameter in a question of type equation (eqRate) like
 {join(if(Q1_SQ001>3,"1","0"),if(Q1_SQ002>3,"1","0"),if(Q1_SQ003>3,"1","0"),if(Q1_SQ004>3,"1","0"),if(Q1_SQ005>3,"1","0"),if(Q1_SQ006>3,"1","0"))}
eqRate will look like this "101001"
and you create the end-url "....?P1={eqRate}"

In your second survey you capture thisparameter in the question "P1"
And as you know that "1" means "rated 4-5" you can display the subquestions in the second survey like
1st subquestion: substr(P1,0,1)=="1"
2nd subquestion: substr(P1,1,1)=="1"
​​​​​​​3rd subquestion: substr(P1,2,1)=="1"
​​​​​​​....

In your first example it is really difficult to get certain informations out of this string
"strpos()" will fail because "5" and "50"
You could surround by comma ",1,3,5,6,7,50,"
Now yocanuse "strpos", like
1st subquestion: strpos(P1;"1,")>0
The first comma avoids a result of "0" which also means "not found"
And this way you can distinguish between
strpos(P1;"5,")>0 (without the comma this would also find "15" or "50" 
strpos(P1;"50,")>0

At the end:
I would always try to have a well defined structure of the parameters. 
E.g. numerical inputs you can leftpad with "0" and the join to something like "012005123056002". Later you easily split into the 5 numbers (again with "substr")

And without a real example it is difficult.
You should send the lss exports of prototypes of the first and second survey.

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 9 months ago - 2 years 9 months ago #226058 by dcspinho
Replied by dcspinho on topic Pass selected answer into another survey
Thanks for your reply. I will try.

I send here some examples lss. 
 

File Attachment:

File Name: limesurvey...ART1.lss
File Size:54 KB

 

File Attachment:

File Name: limesurvey...ART2.lss
File Size:59 KB

Domain - car brand
Sub domain - car model

I want to sent to the 2nd survey the selected answers in the G02Q00 (in the 1st survey).
Based in the selected answers, the group "III - xxx Charateristics" appears for each domain selected (car brand).

For example: If in the 1st survey I select (multiple choice with comment) Volvo Model1, Volvo Model3 and Tesla Other, I want to send to the 2nd survey the questionId of the domain (Volvo) and the info in the field "Other" (if selected this field).
In the 2nd survey I want to show only the group that refers to the answer. In this case will appear "Volvo charateristics" only 1 time and "Tesla charateristics" only 1 time.

In the 2nd survey I want to display the name of the options (sub-domains) selected in the 1st survey. That why I want to send the other field (if selected).  Is it better to send the answer id and the answer name instead of the question id and the name of the other field?
Last edit: 2 years 9 months ago by dcspinho.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 9 months ago #226082 by Joffm
Replied by Joffm on topic Pass selected answer into another survey
Hi, 
there was a lot missing.
There were no questions to capture the parameters.
And what was the meaning of your end-url?

Here you get an example where you transfer all selected brands and models and also the "others"
You see how you capture them in the second survey and may use them.
The relevance equation of the two groups is also implemented.


And the display in the second survey.


 

File Attachment:

File Name: Parte1.lss
File Size:64 KB
 

File Attachment:

File Name: Parte2.lss
File Size:94 KB


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • dcspinho
  • dcspinho's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 8 months ago #226227 by dcspinho
Replied by dcspinho on topic Pass selected answer into another survey
Hello.

It simply worked so well :)
I had no clue how I could catch the parameter in the 2nd survey.

I'm very grateful for your help.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose