- Posts: 49
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
count options marked in a multiple-choice question
- josegovia
- Topic Author
- Offline
- Senior Member
Less
More
5 years 10 months ago #169394
by josegovia
count options marked in a multiple-choice question was created by josegovia
I would like to be able to count how many options a multiple-choice question is marked and use them in a relevant group equation.
For example:
Q1 (multiple-choice question)
Opt1 --- X
Opt2 --- X
Opt3
In the example the question Q1 has marked the response options Opt1 and OPT2 and relevant equation for a group of questions I would like to do is:
If Q1 has more than one option checked and Opt1 == "Y" the group is shown.
Thank you very much.
José
For example:
Q1 (multiple-choice question)
Opt1 --- X
Opt2 --- X
Opt3
In the example the question Q1 has marked the response options Opt1 and OPT2 and relevant equation for a group of questions I would like to do is:
If Q1 has more than one option checked and Opt1 == "Y" the group is shown.
Thank you very much.
José
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 10 months ago #169395
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic count options marked in a multiple-choice question
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: josegovia
The topic has been locked.
- josegovia
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 49
- Thank you received: 2
5 years 10 months ago #169396
by josegovia
Replied by josegovia on topic count options marked in a multiple-choice question
Thank you very much for your quick response.
Now I would like to assign a value to a radio list type response. That is, the value will be marked in the question depending on the relevant equation.
For example, the radio-list-type question is Q2
And the response options are:
V1
V2
V3
V4
Following with the previous example:
If count (that.Q1)> 1 && Q1_Opt1 == 'Y' then Q2 = V2
If count (that.Q1)> 1 && Q1_Opt2 == 'Y' then Q2 = V3
How can I write that?
And also, where do I have to put that code? In the relevant equation of the question?
Thank you very much
Now I would like to assign a value to a radio list type response. That is, the value will be marked in the question depending on the relevant equation.
For example, the radio-list-type question is Q2
And the response options are:
V1
V2
V3
V4
Following with the previous example:
If count (that.Q1)> 1 && Q1_Opt1 == 'Y' then Q2 = V2
If count (that.Q1)> 1 && Q1_Opt2 == 'Y' then Q2 = V3
How can I write that?
And also, where do I have to put that code? In the relevant equation of the question?
Thank you very much
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 10 months ago - 5 years 10 months ago #169428
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic count options marked in a multiple-choice question
Please refer to the manual -
manual.limesurvey.org/Expression_Manager..._Assignment_Operator
So, in you case, the assignment equation would be:
That would be placed in a hidden (via CSS) equation type question directly following Q2.
So, in you case, the assignment equation would be:
Code:
{Q2 = if(count(that.Q1) > 1 && Q1_Opt1 == 'Y', 'V2', if(count(that.Q1) > 1 && Q1_Opt2 == 'Y', 'V3', ''))}
That would be placed in a hidden (via CSS) equation type question directly following Q2.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 10 months ago by tpartner.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12883
- Thank you received: 3965
5 years 10 months ago #169429
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic count options marked in a multiple-choice question
Just, to add:
Why did you start a new thread for this last question?
Now Denis and I answered it in the other thread, Tony here.
So it's confusing.
Joffm
Why did you start a new thread for this last question?
Now Denis and I answered it in the other thread, Tony here.
So it's confusing.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.