- Posts: 21
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Can i show a random answer of a previous question in the text of other question?
- FreshLemonUser
- Topic Author
- Offline
- Junior Member
Less
More
5 years 2 weeks ago #181751
by FreshLemonUser
Can i show a random answer of a previous question in the text of other question? was created by FreshLemonUser
Hi again, thats me... Jejeje
Can i show a random answer of a previous question in the text of other question?
i have this:
Q6Q2. When thinking about your experience with each of the following companies, what are the chances that you will recommend each to a colleague on a scale of 0-10? (Array, 5 subquestions)
Then i Have :
Q6Q2B. In the previous question, you gave a rating of {Q6Q2_SQ001.shown} and to this company you gave a rating of: [ i have to put in here a ramdomly option with answers of 0-3 or 7-10 OF Q6Q2 different from Q6Q2_SQ001 ] can you explain this?
How can i do this: i have to put in here a ramdomly option with answers of 0-3 or 7-10 OF Q6Q2 different from Q6Q2_SQ001.
I´ve tried this, but i know that i have to many errors and i have to do more things:
if((Q6Q2_SQ002.NAOK <= 0 or Q6Q2_SQ002.NAOK >= 7) or
(Q6Q2_SQ003.NAOK <= 0 or Q6Q2_SQ003.NAOK >= 7) or
(Q6Q2_SQ004.NAOK <= 0 or Q6Q2_SQ004.NAOK >= 7),
'I have show any of this Q6Q2')
Please point me on the rigth direction.
i´ll attached some images and a LSG file.
Thanks in advanced.
Can i show a random answer of a previous question in the text of other question?
i have this:
Q6Q2. When thinking about your experience with each of the following companies, what are the chances that you will recommend each to a colleague on a scale of 0-10? (Array, 5 subquestions)
Then i Have :
Q6Q2B. In the previous question, you gave a rating of {Q6Q2_SQ001.shown} and to this company you gave a rating of: [ i have to put in here a ramdomly option with answers of 0-3 or 7-10 OF Q6Q2 different from Q6Q2_SQ001 ] can you explain this?
How can i do this: i have to put in here a ramdomly option with answers of 0-3 or 7-10 OF Q6Q2 different from Q6Q2_SQ001.
I´ve tried this, but i know that i have to many errors and i have to do more things:
if((Q6Q2_SQ002.NAOK <= 0 or Q6Q2_SQ002.NAOK >= 7) or
(Q6Q2_SQ003.NAOK <= 0 or Q6Q2_SQ003.NAOK >= 7) or
(Q6Q2_SQ004.NAOK <= 0 or Q6Q2_SQ004.NAOK >= 7),
'I have show any of this Q6Q2')
Please point me on the rigth direction.
i´ll attached some images and a LSG file.
Thanks in advanced.
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12790
- Thank you received: 3940
5 years 2 weeks ago #181757
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Can i show a random answer of a previous question in the text of other question?
Hi,
yes you can.
My solution is to use two hidden equations.
At first I changed te answer option codes to numerical codes from 0-10.
In the first equation "eq1" I join
{join(if((Q6Q2_SQ002.NAOK<4 OR Q6Q2_SQ002.NAOK>6),"2",""),if((Q6Q2_SQ003.NAOK<4 OR Q6Q2_SQ003.NAOK>6),"3",""),if((Q6Q2_SQ004.NAOK<4 OR Q6Q2_SQ004.NAOK>6),"4",""),if((Q6Q2_SQ005.NAOK<4 OR Q6Q2_SQ005.NAOK>6),"5",""))}
So, if the subquestion matches the requirement a letter is joined.
Example. If companies A and C are rated >7 the string "eq1" is "24"
In the second equation "eq2" I randomly select one of these characters
{substr(eq1,rand(0,strlen(eq1)-1),1)}
Now you have one specific character and are able to display:
In the previous question, you gave a rating of {Q6Q2_SQ001.shown} to company "XXX"
and a rating of {if(eq2==2,Q6Q2_SQ002.NAOK,if(eq2=,Q6Q2_SQ003.NAOK,if(eq2==4,Q6Q2_SQ004.NAOK,Q6Q2_SQ005.NAOK)))} to company "{if(eq2==2,Q6Q2_SQ002.question,if(eq2=,Q6Q2_SQ003.question,if(eq2==4,Q6Q2_SQ004.question,Q6Q2_SQ005.question)))}"
You have to add the check if none of the companies are in the "good" range.
Best regards
Joffm
yes you can.
My solution is to use two hidden equations.
At first I changed te answer option codes to numerical codes from 0-10.
In the first equation "eq1" I join
{join(if((Q6Q2_SQ002.NAOK<4 OR Q6Q2_SQ002.NAOK>6),"2",""),if((Q6Q2_SQ003.NAOK<4 OR Q6Q2_SQ003.NAOK>6),"3",""),if((Q6Q2_SQ004.NAOK<4 OR Q6Q2_SQ004.NAOK>6),"4",""),if((Q6Q2_SQ005.NAOK<4 OR Q6Q2_SQ005.NAOK>6),"5",""))}
So, if the subquestion matches the requirement a letter is joined.
Example. If companies A and C are rated >7 the string "eq1" is "24"
In the second equation "eq2" I randomly select one of these characters
{substr(eq1,rand(0,strlen(eq1)-1),1)}
Now you have one specific character and are able to display:
In the previous question, you gave a rating of {Q6Q2_SQ001.shown} to company "XXX"
and a rating of {if(eq2==2,Q6Q2_SQ002.NAOK,if(eq2=,Q6Q2_SQ003.NAOK,if(eq2==4,Q6Q2_SQ004.NAOK,Q6Q2_SQ005.NAOK)))} to company "{if(eq2==2,Q6Q2_SQ002.question,if(eq2=,Q6Q2_SQ003.question,if(eq2==4,Q6Q2_SQ004.question,Q6Q2_SQ005.question)))}"
You have to add the check if none of the companies are in the "good" range.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: FreshLemonUser
The topic has been locked.
- FreshLemonUser
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 1
5 years 1 week ago - 5 years 1 week ago #181765
by FreshLemonUser
Replied by FreshLemonUser on topic Can i show a random answer of a previous question in the text of other question?
Dear Joffm
Thanks for your help, that was exactly what i needed, you are my hero.
i hope this can be used for the community
Best regards.
A Fresh Lemon User
Thanks for your help, that was exactly what i needed, you are my hero.
i hope this can be used for the community
Best regards.
A Fresh Lemon User
Last edit: 5 years 1 week ago by FreshLemonUser.
The topic has been locked.