Welcome to the LimeSurvey Community Forum

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

Save randomised number as fixed value to prevent messed up orders of questions

  • jacob76
  • jacob76's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 2 days ago - 3 months 2 days ago #254956 by jacob76
Please help us help you and fill where relevant:
Your LimeSurvey version:   LimeSurvey Community Edition    Version 5.6.7+230222
Own server or LimeSurvey hosting: Own server
Survey theme/template: fruity
==================
Hi everyone,

I generated 5 random numbers 1 to 5 using the following code, to create three different groups.
Code:
{if(is_empty(randExp),rand(1,5),randExp.NAOK)}

If random number 1 and 2, treatment group one. If random number 3 and 4, treatment group two. If random number 5, control group. 

Now I would like to show different information for these three groups conditional on the randomised numbers, which also worked out. 

After presenting the information, in the next page, I also want to check if they understand the information correctly. Therefore, I created other questions conditional different groups. And if their answer is wrong, they go to another page to read similar information again. These steps, I set the conditions on the randomised numbers, it won't work anymore. All the order of the questions and questions between different groups got messed up. The questions in treatment group one also got showed up in treatment group two, and so on. 

My colleagues told me that the limesurvey might not save these randomised numbers as fixed value, but they roll the dice every time. That is why it ruined the orders of the questions and the information between groups. I am wondering if we could save these randomised numbers as fixed value somewhere. So it does not ruin the orders of the question and the information between different groups. Or there are other better solutions?

Thank you very much for your kind help in advance.
Last edit: 3 months 2 days ago by jacob76.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 days ago #254960 by holch

My colleagues told me that the limesurvey might not save these randomised numbers as fixed value, but they roll the dice every time. That is why it ruined the orders of the questions and the information between groups. I am wondering if we could save these randomised numbers as fixed value somewhere.


If you would just create a random number, this would be actually true. However, this is prevented by using the construct you are using.

Bad would be:
Code:
{and(1,5)}
Because this way, whenever you call this equation question the dice would be rolled again.

However, by checking if the question is empty and if so roll the dice, if not use the value of the question, you have basically "fixed" the random number, once it has been set once.
Code:
{if(is_empty(randExp),rand(1,5),randExp.NAOK)}

I am currently wondering if .NAOK makes sense here. Because per definition, there must be an answer to randExp if it is not empty. Not sure if this could cause your issue, but then you say that parts run totally fine.

I think there must be something wrong in the rest of your survey structure, so I suggest yo uprovide a LSS file that shows the structure with the issues.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • jacob76
  • jacob76's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 2 days ago - 3 months 2 days ago #254963 by jacob76
Thanks a lot for your quick reply. No matter if I use .NAOK or not, it still did not work out. 

I uploaded my LSS file here. It is highly appreciated if you could check this out. 

In my limesurvey code, I condition on the random number 1, 2, 3, 4 separately, even if random number 1 & 2 are treatment group one, and random number 1 & 2 are treatment group two, because at the beginning I thought "OR" condition was the reason, but it turned out that it was also not the reason.

Thank you so much for your help!!!
Last edit: 3 months 2 days ago by jacob76.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 days ago - 3 months 2 days ago #254965 by Joffm
Hi, there is a lot of not necessary code
(!is_empty(randnumberExp.NAOK) && (randnumberExp.NAOK == 5))  --> randnumberExp == 5
If the value is equal 5, it can't be empty.
You obviously used this "condition designer", didn't you.

{if((is_empty(G07Q05) OR G07Q05 == '109') AND (is_empty(G07Q06) OR G07Q06== '70'), '1', '0')}  --> {if(G07Q05 == 109 AND G07Q06== 70, 1,0)}
All are numerical values; no need to change them to text?

I changed the conditions and everything worked fine (5.6.40)
 

File Attachment:

File Name: limesurvey...7899.lss
File Size:127 KB


Joffm

P.S.
Englisch war ja wieder nicht nötig, wenn @holch und ich hier was erzählen.

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 months 2 days ago by Joffm.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 days ago #254966 by holch
Now that Joffm has looked at it, I don't think I need to have a look at it. Seems my hunch was right and there were mistakes in the subsequent conditions.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: jacob76

Please Log in to join the conversation.

  • jacob76
  • jacob76's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 2 days ago #254967 by jacob76
vielen Dank für Ihre Hilfe!

I use the LSS file that you provided. I am not sure if you have run the survey few more times, because if it worked for you, I think it might be coincidence. Sometimes, I also got the right order due to coincidence. But if I test many times, each time even if I use different ID in the end of URL to test it via a new Incognito window, its order and questions between different groups still got messed up. 

Could you please help me?

Thanks a lot for your kind help. 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 days ago - 3 months 2 days ago #254968 by Joffm
Yes, I tested all 5 possible random numbers; everything's fine.
But I think I have to show a video that you believe.
(Oder ich sollte mal nach Mannheim kommen )

But, why are there a randomization group names in the first group?
It's useless as you display only one single question.

I think you didn't show us everything considering that there are doubled questions 2x15% and 2x70%
Usually you would create only one and display with the conditions
randnumberExp.NAOK lt 3
randnumberExp.NAOK gt 2

Next: In the timers you set "visibility:hidden".
Now you see that questions like G06Q01 get higher after these 10 seconds.
Maybe better to hide (or disable) the "next" button and show (or enable) it after 10 seconds by javascript

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 months 2 days ago by Joffm.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 2 days ago #254970 by Joffm
Oh, now I see that there are randomization group names in the other groups,too.
So you shuffle
G06Q01
G07Q01
G07Q02
(all randomization group name "High" and random number ==1)
so that G06Q01 may appear in group "Check if..." and G07Q02 in group "Information treatment".

I do not think this was your goal.

Joffm
 

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

Please Log in to join the conversation.

  • jacob76
  • jacob76's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 2 days ago - 3 months 2 days ago #254971 by jacob76
ne, ich sollte nach Rodgau kommen, um Ihnen persönlich zu danken

"All are numerical values; no need to change them to text?" No, no need to change them to text. 

"Now you see that questions like G06Q01 get higher after these 10 seconds." What do you mean "get higher" here? Unfortunately, I cannot use javascript, which I do not know why and I do not have the admin right to change the configuration. 

There are doubled questions 2x15% and 2x70%, because I thought that at the beginning the orders got messed up, because I should not use "OR" condition, that is 1 OR 2, when I had to create unequal percentage for three groups. 

All randomization groups were named "High" "Low" or "Control". Yes, I should not have named these randomization groups (I thought it was just nice to name these groups). Under the logic, for randomization group name, it says "Place questions into a specified randomization group, all questions included in the specified group will appear in a random order". After I deleted "High" "Low" or "Control" for randomization group name. The orders and questions between groups remain consistent now. 

Thank you so much for your patience to solve my problem! 

Liebe Grüße aus Mannheim! 
Last edit: 3 months 2 days ago by jacob76.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose