Welcome to the LimeSurvey Community Forum

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

Question Equation assing value

  • josegovia
  • josegovia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
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.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago - 5 years 10 months ago #169404 by DenisChenu
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', ''),
""))}

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
  • josegovia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
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
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169417 by Joffm
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.


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
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose