Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: random)

08 Jan 2026 15:42
Hi,

I display the survey group by group (what's the best practice?)

in online surveys one rule is "one question per page".
Except two short questions, or a follow-up question like "Please, explain why you rated so low"

To be most flexible, we recommend to display "group by group", but with only one question per group.
This way the participant has the look&feel of "question per question", but you are able to merge some questions by javascript, display two questions on one page, etc.
This is in my opinion the best way in 90% of all survey designs.
If there are special requirements (mostly concerning randomisations) there may be necessary other solutions.

Joffm
08 Jan 2026 14:37
Thanks Joffm.

I've gone by the second option and it's working great. 

@holch I display the survey group by group (what's the best practice?). Thanks for the side tip on format as well. Not sure what exact exactly is wrong because I also found the font in Joffm's screenshots too tiny, but from my preview end, it's legible enough (using Georgia default size). 
08 Jan 2026 14:05
And if you are allowed to use javascript you can insert this script into the question (source code mode)
Code:
<script type="text/javascript" data-author="Tony Partner">   $(document).on('ready pjax:scriptcomplete',function(){     var thisQuestion = $('#question{QID}');     var thisAnswerList = $('tr.answers-list:eq(0)', thisQuestion).parent();     var r=Math.floor(Math.random() * 2);     var sqCodes = [1,2,3,4,5,6];     if (r==1) { sqCodes = [6,5,4,3,2,1]; }       // Loop through the answer codes     $.each(sqCodes, function(i, val) {       // Move the answer item       $(thisAnswerList).append($('tr.answers-list[id$="X{QID}'+val+'"]', thisQuestion));     });   }); </script>





Joffm
08 Jan 2026 13:06
One tip that has nothing to do with this: i would format the text in the questions a bit better, I find them currently very hard to read and follow.

A little structure would certainly help with that.
08 Jan 2026 13:05
@Joffm: Yeah, I fixed that too, but forgot to mention it yesterday. Thanks for pointing that out. This would have been a show stopper as well.

@c.otieno: OK, strange. For me it only worked when I put the "group" questions into a second question group. Do you display the survey question by question?

I don't think there is a way to order the subquestions via expression script, so you will probably have to go down the route Joffm described. Create 2 versions of the Group3 question and order the answers/subquestions accordingly.

This will require a different distribution and thus a different approach to the randomized number. Joffm has explained two approaches already.
08 Jan 2026 12:53
Double the question
Q3a: display in ascending order
Q3b: display in descending order

Randomisation:
Either create your RANDGROUP from 1 to 6 and show
Q1: RANDGROUP <3 ( 1 or 2)
Q2: RANDGROUP== 3 or RANDGROUP==4
Q3a: RANDGROUP ==5
Q3b: RANDGROUP ==6

OR
create a second random number "R2" (1 to 2) and show
Q1 and Q2, as you did already
Q3a: RANDGROUP==3 AND R2==1
Q3b: RANDGROUP==3 AND R2==2

Joffm


 
08 Jan 2026 11:49
Hi Joffm and Holdch,

I have fixed the typo in my equation and it's now worked :)

@holch I have now defined the condition for all three groups. Thanks :). But I've not had to to have the questions in a separate group after fixing the typo. 

I'm currently looking up how I can have half of the participants in GROUP3 see the percentages displayed in an ascending order (while the other half as already is), to avoid bias in responses. Basically randomizing GROUP3 answers into 2 orders, ascending and descending.

I'd appreciate any tips:)
08 Jan 2026 00:00
Replied by Joffm on topic randomize matrix questions
Usual way:
Create two groups (B1 and B2)
B2 is hidden.
Put 60 questions into each group
ALL questions get the same "randomisation group name"

That's all.

BTW: why don't you screen out the non-consenters right after that question? Buzzword: quota.

Joffm

Only a short answer, because sometimes I am tired to write English without necessity.
07 Jan 2026 23:51
Hi,
and the reason for this (not possible to display in one group) was this typo.
{if(is_empty(RANDGROUP), rand(1,3)RANDGROUP)}

Remember: The IF function has three parameters
1. the condition "is_empty(RANDGROUP)"
2. what happens, if the condition is TRUE "create a random value: rand(1,3)"
3. What happens, if the condition is FALSE "keep the existing value: RANDGROUP"

Therefore
{if(is_empty(RANDGROUP), rand(1,3), RANDGROUP)}




Joffm
07 Jan 2026 23:18
First of all: When testing, always show the hidden questions, it might give you some hints if things go wrong somewhere. If the random number for example is hidden, you won't know if the correct question is shown, based on that random number.

I have also included RAND1, RAND2, RAND3 at the beginning of the question, because the text looks very similar for each of the groups, so it is difficult to see if the right text is shown or not.

Those are some general tips to make testing and trouble shooting easier.

However, but all this is not your issue.

For group 1 and 2 you defined the condition, for group 3 you defined subquestion relevance and no condition on the question, which seems to be odd to me.

So I fixed that.

I also moved the scenarios into a separate group and they now show, depending on the random number, when "no" is chosen in the first question.

So the issue is that you need to have them in separate groups (show them on different pages) than the first question.
07 Jan 2026 22:38
Hi Holch,
Sorry for any inconveniences. I am fairly green to Limesurvey.

I have now uploaded an LSS file of the relevant parts of my survey as instructed.

I've also amended the equation question rand(1,3) to {if(is_empty(RANDGROUP), rand(1,3) RANDGROUP)}.

I hope you can now trace my issue. 

Looking forward to your response.
07 Jan 2026 21:19
Please do not provide LSQ or LSG files, only LSS files. Why?

Because we need to create a survey and survey groups to import your LSQ, which adds to the work load. Also, we need to guess the base language to be able to import the LSQs into the survey.

So, please provide a LSS file. And no, we do not want your whole survey, only the relevant parts are enough. How to do this?

copy the survey, delete everything that is not necessary, export this cleaned survey as LSS and upload it here.

Also, make sure that you create the random number correctly, rand(1,3) is usually not enough. There are many examples in the forum on how to create good (and stable) random number in Limesurvey.
07 Jan 2026 20:26
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 6.16.1+251125 
Own server or LimeSurvey hosting: Own server
Survey theme/template: inherited
==================
Hello!

Id like present 60 random questions out of the 120 matrix questions. Each participant should get a random selection of 60 questions out of the 120.
I tried the .relevancestatus code, but it shows as undefined variable.
What did i do wrong?

Thank you.
07 Jan 2026 19:41
Hi Joffm,
Thanks for your reply. I have attached the relevant files.

Here is what I want to achieve:
 - My Q1 is coded EVERTEST and it asks respondents: Have you ever tested for a genetic condition X? (Yes/No)
 - If the respondent answers 'No', they need to be randomized into one of the three questions coded (GROUP1, GROUP2, or GROUP3)
 - For the randomization, I've created a hidden equation question RANDGROUP.

The problem:
Even after effecting the conditions, when I preview the survey and answer 'No' to EVERTEST, I am not randomized into any of the three groups. Instead, I'm proceeded to the next section of the survey as someone who would have answered yes. I hope the issue is clearer now.
07 Jan 2026 18:31
Hi,
sorry, I did not understand exactly what you want to achieve.
But the first part is easy.
If your Yes/No question is Q1 and the equation RANDGROUP, then your three random questions get the condition
1st: Q1=="N" AND RANDGROUP==1
2nd: Q1=="N" AND RANDGROUP==2
3rd: Q1=="N" AND RANDGROUP==3

And as I wrote, this is entered in "condition" (general settings) on question level.

If there are further quesrions, please send the lss export of the survey, resp. the relevant parts.
Joffm
 
Displaying 196 - 210 out of 234 results.

Lime-years ahead

Online-surveys for every purse and purpose