Can i show a random answer of a previous question in the text of other question?

More
1 week 2 days ago #181751 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.
Attachments:

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
1 week 2 days ago #181757 by Joffm
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==3,Q6Q2_SQ003.NAOK,if(eq2==4,Q6Q2_SQ004.NAOK,Q6Q2_SQ005.NAOK)))} to company "{if(eq2==2,Q6Q2_SQ002.question,if(eq2==3,Q6Q2_SQ003.question,if(eq2==4,Q6Q2_SQ004.question,Q6Q2_SQ005.question)))}"

File Attachment:

File Name: limesurvey...7817.lss
File Size:23 KB


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
Attachments:
The following user(s) said Thank You: FreshLemonUser

Please Log in or Create an account to join the conversation.

More
1 week 2 days ago - 1 week 2 days ago #181765 by FreshLemonUser
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
Last edit: 1 week 2 days ago by FreshLemonUser.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!