Welcome to the LimeSurvey Community Forum

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

question text

More
6 years 10 months ago #154954 by plab
question text was created by plab
Hi there,
how can I show the question text in different sequence?

for example the question is:
Thinking about public expenditure on UNEMPLOYMENT BENEFITS, DEFENSE, OLD-AGE PENSIONS, and WELFARE BENEFITS, which one you think should be more than now?

some people will see the other sequence, like
Thinking about public expenditure on OLD-AGE PENSIONS, UNEMPLOYMENT BENEFITS, WELFARE BENEFITS and OLD-AGE PENSIONS, which one you think should be more than now?

Thinking about public expenditure on OLD-AGE PENSIONS, WELFARE BENEFITS, OLD-AGE PENSIONS and UNEMPLOYMENT BENEFITS, which one you think should be more than now?


is that we can do this question text type on the limesurvey?


many thanks.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago - 6 years 10 months ago #154965 by tpartner
Replied by tpartner on topic question text
You can use Expression Manager to load a hidden equation question with a random number between 1 and 3. Then you can use nested IF statements to display one of those 3 text strings.

Code:
{if(random == 1, 'Text string 1.', if(random == 2, 'Text string 2.', 'Text string 3.'))}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.
More
6 years 10 months ago - 6 years 10 months ago #154989 by plab
Replied by plab on topic question text
Attached file 1 is the hidden equation question with a random number between 1 and 3.
Attached file 2 is when I setting the question, I have no idea where the nested IF statements should be display.
Code:
{if(random == 1, 'Text string 1.', if(random == 2, 'Text string 2.', 'Text string 3.'))}
Last edit: 6 years 10 months ago by plab.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #155008 by tpartner
Replied by tpartner on topic question text

I have no idea where the nested IF statements should be display.

It's simply placed in the question text.





Sample survey attached:

File Attachment:

File Name: limesurvey...5-18.lss
File Size:14 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: plab
The topic has been locked.
More
6 years 10 months ago - 6 years 10 months ago #155044 by plab
Replied by plab on topic question text
many thanks.

IF I have more than 3 Text string need to show in different sequence, how the nested IF statements should be present?

Code:
{if(random == 1, 'Text string 1.', if(random == 2, 'Text string 2.', 'Text string 3.', 'Text string 4.', 'Text string 5.'))}

or
Code:
{if(random == 1, 'Text string 1.', if(random == 2, 'Text string 2.', if(random == 3, 'Text string 3.', 'Text string 4.', 'Text string 5.'))}

BECAUSE I need more than 6 Text string to show in different sequence, but when I try 5, it seems to some problem.
Last edit: 6 years 10 months ago by plab.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 10 months ago #155058 by tpartner
Replied by tpartner on topic question text
The IF statements work like this:

Code:
{if(condition, 'Returned result if true', 'Returned result if false')}

If nesting (multiple IF statements) is necessary, replace 'Returned result if false' with another complete IF statement like this (line-breaks inserted for clarity):

Code:
{if(condition1, 'Returned if true', 
  if(condition2, 'Returned if true', 
    if(condition3, 'Returned if true', 
      if(condition4, 'Returned if true', 
        if(condition5, 'Returned if true', 'Returned if all conditions false'
))))}

So, in your example, it would be like this (line-breaks inserted for clarity):

Code:
{if(random == 1, 'Text string 1.', 
  if(random == 2, 'Text string 2.', 
    if(random == 3, 'Text string 3.', 
      if(random == 4, 'Text string 4.', 
        'Text string 5.'
))))}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: plab
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose