- Posts: 19
- Thank you received: 0
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
- Topic Author
- Offline
- New Member
Less
More
5 years 8 months ago #172383
by CarolinEkman
Use Relevance Equation to only show sub questions selected in previous question was created 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!
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.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 8 months ago #172386
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Use Relevance Equation to only show sub questions selected in previous question
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 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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 8 months ago #172388
by CarolinEkman
Replied by CarolinEkman on topic Use Relevance Equation to only show sub questions selected in previous question
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)
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)
Attachments:
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 8 months ago #172393
by jelo
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.
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
Replied by jelo on topic Use Relevance Equation to only show sub questions selected in previous question
Please try to add this into the subquestion relevance field.CarolinEkman wrote: In "F", I only want to show sub question with code "SQ001"
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 8 months ago #172444
by CarolinEkman
Replied by CarolinEkman on topic Use Relevance Equation to only show sub questions selected in previous question
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.
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.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 8 months ago #172452
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Use Relevance Equation to only show sub questions selected in previous question
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 8 months ago #172509
by CarolinEkman
Replied by CarolinEkman on topic Use Relevance Equation to only show sub questions selected in previous question
Please find attached a newly exported survey.
Thank you very much in advance!
Carolin
Thank you very much in advance!
Carolin
Attachments:
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 8 months ago #172529
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Use Relevance Equation to only show sub questions selected in previous question
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.
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
Attachments:
The topic has been locked.
- CarolinEkman
- Topic Author
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 0
5 years 8 months ago #172562
by CarolinEkman
Replied by CarolinEkman on topic Use Relevance Equation to only show sub questions selected in previous question
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!
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.