Welcome to the LimeSurvey Community Forum

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

Randomly select 2 out of 8 groups,then select 2 out of the rest 6 (V3.23.3)

  • CoraZHAO
  • CoraZHAO's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago - 3 years 6 months ago #205548 by CoraZHAO
Hi I'm now designing a survey which requires the following structrue:

1. Randomly show 2 question groups out of 8.

2. Secondly, a mandatory question group.

3. Thirdly, randomly show another 2 question groups out of the rest 6 groups.

4. Last step, a mandatory question group.

I've checked this very related topic.
forums.limesurvey.org/forum/design-issue...-version-3-22#195815
But mine is slightly different becasue I need to show 2 random groups firstly. Followed with several fixed questions. And then show another 2 question groups from the rest of 6.

I was wondering if there's any way to do this?
Thank you so much for your help.

Best regards,
ZHAO
Last edit: 3 years 6 months ago by CoraZHAO.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205554 by Joffm
Hi,
1. All your 6 random groups get the same "group randomization name"

2. Order your groups like this
G1
G2
Group fixed 1
G3
G4
G5
G6
G7
G8
Group fixed 2
This will show two of the eight random groups at the beginning, then the first fixed group, then the 6 remaining random groups.

3. To show only 2, you have to count.
In all random groups add a question of type equation.
Call them G1Count, G2Count,...
Only enter this equation {1}

4. All random groups get the relevance equation
sum(G1Count.NAOK,G2Count.NAOK,G3Count.NAOK,G4Count.NAOK,G5Count.NAOK,G6Count.NAOK,G7Count.NAOK,G8Count.NAOK) < 5

That's all.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: CoraZHAO
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205555 by holch
I think this can be done quite straight forward with "randomization group" feature.

You create 9 groups, the 8 that should be randomized and the one that should be stationary like this:

Group Rand1
Group Rand2
Group "Stationary"
Group Rand3
Group Rand4
Group Rand5
Group Rand6
Group Rand7
Group Rand8

The groups "Rand1" to "Rand8" all receive the same randomization group name. This will randomize the questions among the 8 positions, while the Group "Stationary" will always be on the 3rd position, because it is not part of the "randomization group". So the first part (randomization of the question groups on the random positions 1, 2, 3 and 4) is done.

Now at first I thought that we could just use "always hide" to hide groups Rand5 to Rand8, but this won't work, the always hide would not stick with the position, but with the Group.

What you now need to do is to create relevance equations that hide groups based on the position within the survey.

You will need to use gseq to find out at which position the group is in the survey ( manual.limesurvey.org/Expression_Manager - search for gseq).

It starts with 0, so you probably have to use something like this as relevance equation for all questions groups from "Rand1" to "Rand8":
[code]self.gseq > 3[/quote]

I haven't tried it and I am not sure if self.gseq works here. Usually there should be the question code before the .gseq.

If self doesn't work you could try to use the first question code within the group to check gseq. But you will need to try this.

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: CoraZHAO
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205556 by holch
OK, Joffm beat me to it again. Like always. And the idea with the sum is good. Still wondering if .gseq would work.

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: CoraZHAO
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205557 by Joffm
.gseq will work, in my opinion.
Here I used this (Denis' proposal) to avoid the adapting of the group numbers. I will create two examples.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 6 months ago #205568 by Joffm
Hi,
here is an example with .gseq.

Remember: .gseq contains the sequential number of the displayed group starting with 0.
So the first random groups have numbers 0 and 1
the fixed group 2,
the next random groups 3 and 4.
Therefore the condition is: .gseq<5

If you add fixed groups somewhere you have to consider this and adapt accordingly.

File Attachment:

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


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: holch
The topic has been locked.
  • CoraZHAO
  • CoraZHAO's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 6 months ago #205657 by CoraZHAO
Hi, Joffm and holch,


Thank you for your very quick reply.I tried the first solution from Joffm and it works perfectly. :)You helped me solve a problem confused me for days.

I'didnt try the .lss file yet since I'm not authorized for importing a new survey from my administrator. But I'm sure it will definately help other guys who meet the same issue.

Thanks again for all your suggestions.
Best regards,
ZHAO
The topic has been locked.
  • CoraZHAO
  • CoraZHAO's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #207416 by CoraZHAO
Hi Joffm
I used the approach you shared, it works very well.
But I just found there is always an empty page after the last random group.
You can see the survey here,
tueindhoven.limequery.com/619641?lang=en
(You need to click 'next' button around ten times to see it. The page before question 61).

I checked if I make some wroing code but nothing found.
Do you know why this happen and how to fix it?

Thank you so much for your time.
Best regards,
Yuwen
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #207417 by Joffm
Hi,

Do you know why this happen and how to fix it?

Of course not.
Without your lss export we can't see if and where there is a small mistake in your structure or code or thinking.

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • CoraZHAO
  • CoraZHAO's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #208047 by CoraZHAO
Hi, sorry I reply this late since I've been updating the survey and hoping that this error will disappear itself.

However I checked again the blank page is still there, before question 61.

Please see attached the .lss file of the whole survey.


Part of the message is hidden for the guests. Please log in or register to see it.


Thank you.

Best regards,
ZHAO
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 months ago #208058 by Joffm
Hi,

it's a problem with your group relevance.
If your groups had names which you displayed during test, you'd have seen that a fifth group appears shortly then it is hidden.

I will give you a different solution to select the four groups, tomorrow.

Best wishes to Eindhoven

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • CoraZHAO
  • CoraZHAO's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 months ago #208087 by CoraZHAO
Hi Joffm,
Thank you for your quick reply!
Looking forward to the update.
Good morning and have a nice day!

Best,
Yuwen.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose