- Posts: 49
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Question Equation assing value
- josegovia
- Topic Author
- Offline
- Senior Member
Less
More
5 years 10 months ago #169403
by josegovia
Question Equation assing value was created by josegovia
Hello
Do you know why this equation type question does not work? The equation assigns a value to another question depending on the value of a previous multiple response question.
I attach a file with the example.
Thank you.
Do you know why this equation type question does not work? The equation assigns a value to another question depending on the value of a previous multiple response question.
I attach a file with the example.
Thank you.
Attachments:
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13648
- Thank you received: 2491
5 years 10 months ago - 5 years 10 months ago #169404
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Question Equation assing value
1st issue : count(P1_1, P1_2, P1_3) = 1 : only one = here
2nd issue : you assign P2 at first line, and after at 2nd line and after at third .
You need one line assignation.
Something like (not tested)
{P2=(join(
if(count(P1_1, P1_2, P1_3) == 1 AND P1_1 == 'Y', '1', ''),
if(count(P1_1, P1_2, P1_3) == 1 AND P1_2 == 'Y', '2', ''),
if(count(P1_1, P1_2, P1_3) == 1 AND P1_3 == 'Y', '3', ''),
""))}
2nd issue : you assign P2 at first line, and after at 2nd line and after at third .
You need one line assignation.
Something like (not tested)
{P2=(join(
if(count(P1_1, P1_2, P1_3) == 1 AND P1_1 == 'Y', '1', ''),
if(count(P1_1, P1_2, P1_3) == 1 AND P1_2 == 'Y', '2', ''),
if(count(P1_1, P1_2, P1_3) == 1 AND P1_3 == 'Y', '3', ''),
""))}
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 10 months ago by DenisChenu.
The topic has been locked.
- josegovia
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 49
- Thank you received: 2
5 years 10 months ago #169410
by josegovia
Replied by josegovia on topic Question Equation assing value
It does not work, the same thing happens, it does not assign the value to question P2.
I attached the file with the code you told me.
Thank you
I attached the file with the code you told me.
Thank you
Attachments:
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12941
- Thank you received: 3979
5 years 10 months ago #169417
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Question Equation assing value
Hi,
this equation is suficient; join is not really necessary, because P2 is single punch.
{P2=if(count(P1_1, P1_2, P1_3) == 1 AND P1_1 == 'Y', 1, if(count(P1_1, P1_2, P1_3) == 1 AND P1_2 == 'Y', 2, if(count(P1_1, P1_2, P1_3) == 1 AND P1_3 == 'Y', 3,P2)))}
If you don't set the P2 here you will empty P2 in case you have more than one anwer in P1.
See example.
Regards
Joffm
this equation is suficient; join is not really necessary, because P2 is single punch.
{P2=if(count(P1_1, P1_2, P1_3) == 1 AND P1_1 == 'Y', 1, if(count(P1_1, P1_2, P1_3) == 1 AND P1_2 == 'Y', 2, if(count(P1_1, P1_2, P1_3) == 1 AND P1_3 == 'Y', 3,P2)))}
If you don't set the P2 here you will empty P2 in case you have more than one anwer in P1.
See example.
Regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.