Question Equation assing value

9 months 2 weeks ago #169403
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.
Attachments:

LimeSurvey Partners
9 months 2 weeks ago - 9 months 2 weeks ago #169404
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', ''),
""))}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 9 months 2 weeks ago by DenisChenu.

9 months 2 weeks ago #169410
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
Attachments:

9 months 2 weeks ago #169417 by Joffm
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.

File Attachment:

File Name: limesurvey...7278.lss
File Size:18 KB

Regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless