Check out the LimeSurvey source code on GitHub!

User Role based show/hide questions in a survey?

More
4 years 4 days ago #91020 by AriM
User taking the survey is authenticated, each user is assigned a GroupRole attribute in setup. In a survey questions are shown/hidden based on this attribute. Is this possible?

Please Log in to join the conversation.

More
4 years 4 days ago #91022 by holch
This should be possible if you use tokens. You can include the GroupRole attribute as a custom attribute in the token table and then refer to it from within the survey logic and show or hide a question, depending on the GroupRole from the token table.

Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: AriM

Please Log in to join the conversation.

More
3 years 11 months ago #92315 by pedrorobalo
Hi holch,

Did you manage to implement it using tokens? I am trying to do something similar. I want the survey to be anonymous and I only want a limited number of subjects to participate, let's say 100. For 50 of them I want the variable (let's call it GroupRole) to take one value, say 1, and for the other 50 I want GroupRole to take value 2. Since I want the survey to be anonymous this means that any new user generates a new token (by introducing an e-mail account in the initial page), but for which the value of GroupRole is not defined... Did you run into a similar problem? Thanks for any feedback.

Please Log in to join the conversation.

More
3 years 11 months ago #92316 by AriM
Pedrorobalo,

Holch answered my question.
I did not go further than that using tokens.
We are using Version 1.92+ Build 120517.
In DEV environment using token attributes works
but in TST environment I get undefined variable error for token
(which was fixed in Build 120418). I am working on that!

In any case, you can try the following not sure if it will work though:
create an equation question that uses random function (generate 1 or 2)
use quotas for this question(equation) response: 1 ---> 50responses
and similarly for response 2. No need for tokens unless you need it for another reason.

Holch might have a better answer for you.

Good Luck,

AriM
The following user(s) said Thank You: pedrorobalo

Please Log in to join the conversation.

More
3 years 11 months ago #92318 by pedrorobalo
AriM,

Thank you very much, that might solve my problems.

Best

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form