Welcome to the LimeSurvey Community Forum

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

SOLVED: Hide / reveal question based on specific users' completing survey

  • bulgin
  • bulgin's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #190913 by bulgin
Hello.

Need to either hide or reveal a question based on whether certain tokenized users have completed a survey or not.

300 total survey participants.

When 40 particular tokens (or some other method to gauge specific users) are used, hide/reveal a specific question.

The 40 particular users have an attribute_1 that is different than other attribute_1's.

Thank you.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190922 by Joffm
As far as I understand, these 40 participant do not see this question.

Well, this is just relevance equation:
Let's say these participants have an ATTRIBUTE_1 = 1, all others something else.
Then the question relevance equation is something like:
"TOKEN:ATTRIBUTE_1!=1"

Or did I misunderstand?

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • bulgin
  • bulgin's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #190925 by bulgin
Joffm you've excelled again! Thanks that looks perfect.

Only twist is this: although 40 of them have a different attribute_1 than the other participants, it's not exactly a 1=1 type of attribute_1.

I mean, for example, all 40 have a sequence of numbers and letters totaling for example 19 characters.

Like so: x87v-4489-2Y65-4987
or so: o998-ju76-lkfd-4444
etc.

Can regex be used in these formulas? That would probably solve the issue.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago #190926 by Joffm
But you know these 40 participants.
And can add an attribute_2 to them which is equal to all.

Or you extend the relevance equation:
TOKEN:ATTRIBUTE_1=="x87v-4489-2Y65-4987" OR TOKEN:ATTRIBUTE_1=="o998-ju76-lkfd-4444" OR ...
But in my opinion this is the worst approach.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • bulgin
  • bulgin's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #190928 by bulgin
Yes, adding the 40 to attribute_2 is perfect! Perfect solution.

Now I just need to tweak the basic admin email which is different for the 40 than the others, but I think that can be accomplished with a solved post by dotxm here:

www.limesurvey.org/forum/can-i-do-this-w...a-question-condition
The topic has been locked.
  • bulgin
  • bulgin's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #190930 by bulgin
In the manual here:
manual.limesurvey.org/Expression_Manager...ons_.3D.3E_Relevance

It states "Important: It is only safe to refer to variables that occur in preceding pages or questions. "

Could that be the reason when I input either of the following conditions in the relevance field of "edit question" page, Limesurvey fails to either show or hide the question. I.e., it's not working:

TOKEN:ATTRIBUTE_1!=1 <--- when attribute_1 contains either 1 or 2 or nothing.

or

!is_empty(TOKEN:ATTRIBUTE_1) <---- when attribute_1 contains 1 or 2 or nothing.
The topic has been locked.
  • bulgin
  • bulgin's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
4 years 4 months ago #190931 by bulgin
Need to be careful of syntax the following actually *does* work. There was a bad character in the string.

This works:

!is_empty(TOKEN:ATTRIBUTE_1)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose