Welcome to the LimeSurvey Community Forum

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

Use Relevance Equation to only show sub questions selected in previous question

  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172383 by CarolinEkman
I have 2 questions of the type Array (number), with check boxes, similar to this:

Q1:
Product 1 [use 1] [use 2] [use 3]
Product 2 [use 1] [use 2] [use 3]
Product 3 [use 1] [use 2] [use 3]

Q2:
Product 1 [country 1] [country 2] [country 3]
Product 2 [country 1] [country 2] [country 3]
Product 3 [country 1] [country 2] [country 3]



I want to do the following:
In Q2, I only want to show sub question "Product 1" IF in Q1, I selected "Product 1"/"use 2"

I have researched as much as I could in this forum and believe I need to enter something under "edit subquestion relevance" for each specific subquestion in Q2?

But what I am struggling with is, what exactly do I need to enter? The codes I tried to enter didn't work. I am very new to LimeSurvey and not very good at programming so it doesn't come intuitively to me. I would really appreciate if anyone could help guide me with regards to the principle of how to construct whatever needs to go into the "edit subquestion relevance" field.

Many thanks in advance!
The topic has been locked.
More
5 years 8 months ago #172386 by jelo
You should add a survey export for these questions and tell us the version of LimeSurvey.

The naming for these arrays is a bit different.


codequestion = code of the arrayquestion
qy001 = code of the subquestion (Y-Scale)
qx001 = code of the answerfield (X-Scale)

The first field as a variable name would be accessed via EM as "codequestion_qy001_qx001.NAOK"

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172388 by CarolinEkman
thank you very much for your willingness to help!

Attached is the survey.

The questions I am referring to are the following:

c2test:
code SQ001
code SQ002
code SQ003
and so on...

F:
code 1
code 2
code 3
and so on...



I want to do the following:
In "F", I only want to show sub question with code "SQ001"
IF
in "c2test", I selected code SQ001 (on the Y scale) / code SQ002 (on the X scale)
The topic has been locked.
More
5 years 8 months ago #172393 by jelo

CarolinEkman wrote: In "F", I only want to show sub question with code "SQ001"

Please try to add this into the subquestion relevance field.
Code:
(!is_empty(c2test_SQ001_SQ002.NAOK)

The subquestionrelevance field can have a value of 0 or 1. 1 means display subquestion, 0 means hide subquestion.

So we want the statement getting a value of 1 when the checkbox is ticked.
The "is_empty" function is 1 when the variable c2test_SQ001_SQ002.NAOK is empty.
We want the opposite. The "!" in front of is_empty is the NOT function, which reverse the statement.

If c2test_SQ001_SQ002.NAOK is NOT empty, then show the subquestion.
Code:
(!is_empty(c2test_SQ001_SQ002.NAOK)


You can prevent many mistakes when you change the default naming on the X and Y scale. So not SQ but e.g. SQX and SQY.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172444 by CarolinEkman
Many thanks for the explanation, very pedagogic and clear! :)

I followed your advice to change the names of the codes, to SY001 - SY010 on the Y axis and SX001 - SX010 on the X axis. (for both questions c2test and F)

I entered the following the "subquestion relevance" box next to SYOO1 in question F:
(!is_empty(c2test_SY001_SX002.NAOK)

But when I test, I still see the subquestion SY001 regardless of whether I have ticked SX002 in C2test, or not.
The topic has been locked.
More
5 years 8 months ago #172452 by jelo
Please attach your updated surveyfile here.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172509 by CarolinEkman
Please find attached a newly exported survey.

Thank you very much in advance!
Carolin
The topic has been locked.
More
5 years 8 months ago #172529 by jelo
You have invalid conditions on the whole question.
Remove them all.



The subquestion relevance has a missing parenthesis (you just copied my mistake from the board here).
(!is_empty(c2test_SY001_SX002.NAOK))
That should do the trick.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • CarolinEkman
  • CarolinEkman's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago #172562 by CarolinEkman
Thank you so much for your help!!! I added the missing bracket and it seems to work!
I did not even remove the conditions (I believe they work as I intended, i.e. to only show the entire question in case certin answers have been checked in the previous question).

Really appreciate your willingenss to help and your prompt reactions to my questions, thanks so much once again!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose