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

5 Monate 2 Tage her #181751
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.

##### Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
5 Monate 2 Tage her #181757 von 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)))}"

#### Dateianhang:

Dateiname: limesurvey...7817.lss
Dateigröße: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
##### Anhänge:
Folgende Benutzer bedankten sich: FreshLemonUser

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

5 Monate 2 Tage her - 5 Monate 2 Tage her #181765
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
Letzte Änderung: 5 Monate 2 Tage her von FreshLemonUser.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.