equation question - syntax issue

Mehr
5 Monate 2 Wochen her #173411 von marektondryk
COM_KUNENA_MESSAGE_CREATED_NEW


I have 3 questions (q1, q2, q3) radio list each one with answers 'yes' (A1) and 'no' (A2).
I want answer returned from equation question for condition:
{if answer for q1=A2 and answer for q2=A2 and answer for q3=A2 than "red" or
if answer for q1=A1 and answer for q2=A2 and answer for q3=A2 than "green" or
if answer for q1=A1 and answer for q2=A1 and answer for q3=A2 than "blue" or
if answer for q1=A1 and answer for q2=A1 and answer for q3=A1 than "yellow"}

How should this equation question look like?
Anhang:

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her - 5 Monate 2 Wochen her #173415 von DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW
I do :
{join(
if(q1=="A2" and q2=="A2" and q3=="A2",'red',''),
if(q1=="A1" and q2=="A2" and q3=="A2",'green',''),
if(q1=="A1" and q2=="A1" and q3=="A2",'blue',''),
if(q1=="A1" and q2=="A1" and q3=="A1",'yellow',''),
'')}
Because it's more simple to understand and fix then imbricated if : manual.limesurvey.org/Expression_Manager...Conditional_Logic.29

(corrected)

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: 5 Monate 2 Wochen her by DenisChenu. Begründung: Use == not = silly boy
Folgende Benutzer bedankten sich: marektondryk

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173418 von jelo
COM_KUNENA_MESSAGE_REPLIED_NEW

However, we recommend using the join() function for concatenation, as that makes your intent more clear, and avoids unexpected results if you were expecting strings but got numbers instead (or vice versa).

manual.limesurvey.org/Expression_Manager#Operators

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Folgende Benutzer bedankten sich: marektondryk

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173421 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
Why the join function? Since they are mutually exclusive, why not simply use four IF() statements (not nested)?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: marektondryk

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her - 5 Monate 2 Wochen her #173422 von DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW

tpartner schrieb: Why the join function? Since they are mutually exclusive, why not simply use four IF() statements (not nested)?

Maybe in future Equation question type save line feed ;).

But currently : you're right, can be done with
{if(q1=="A2" and q2=="A2" and q3=="A2",'red','')}
{if(q1=="A1" and q2=="A2" and q3=="A2",'green','')}
{if(q1=="A1" and q2=="A1" and q3=="A2",'blue','')}
{if(q1=="A1" and q2=="A1" and q3=="A1",'yellow','')}

(Edited/corrected)

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: 5 Monate 2 Wochen her by DenisChenu. Begründung: Use == not = silly boy !
Folgende Benutzer bedankten sich: marektondryk

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173446 von marektondryk
COM_KUNENA_MESSAGE_REPLIED_NEW
Thanks guys :)
I put code:
{if(q1="A2" and q2="A2" and q3="A2",'red','')}
{if(q1="A1" and q2="A2" and q3="A2",'green','')}
{if(q1="A1" and q2="A1" and q3="A2",'blue','')}
{if(q1="A1" and q2="A1" and q3="A1",'yellow','')}

into new equation question and I don't get yellow,blue, etc. answer...
What should I do???? :(

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173448 von holch
COM_KUNENA_MESSAGE_REPLIED_NEW
Send a LSS file with what you have done.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173455 von marektondryk
COM_KUNENA_MESSAGE_REPLIED_NEW

Dateianhang:

Dateiname: test.lss
Dateigröße:16 KB
Anhang:

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her - 5 Monate 2 Wochen her #173457 von vkuzmin
COM_KUNENA_MESSAGE_REPLIED_NEW
Use dual equality == to compare values
UPD: And use quotes instead of apostrophes.
Last edit: 5 Monate 2 Wochen her by vkuzmin.
Folgende Benutzer bedankten sich: marektondryk

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173471 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW

Use dual equality == to compare values

Duh...that's a rookie mistake, not catching that :)

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Folgende Benutzer bedankten sich: marektondryk

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173479 von marektondryk
COM_KUNENA_MESSAGE_REPLIED_NEW
Thanks!!!!! :) Works GREAT!!!

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173482 von DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW

tpartner schrieb:

Use dual equality == to compare values

Duh...that's a rookie mistake, not catching that :)

Arg … my mistake … :S

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 .

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173571 von marektondryk
COM_KUNENA_MESSAGE_REPLIED_NEW
Is it possibe to set condiotion e.g.
{if(q1=="A2" and q2=="A1" and q3=="A1",'Yor answers aren't logical','')}
which doesn't allow to click button NEXT?

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173574 von tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
Depending on the question type, you can use the Question validation equation and Tip for whole question validation equation - manual.limesurvey.org/Question_type_-_Li...28em_validation_q.29

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Mehr
5 Monate 2 Wochen her #173575 von marektondryk
COM_KUNENA_MESSAGE_REPLIED_NEW
May I use this for 3 radio list questions condition or just for one?

Bitte Anmelden oder Registrieren um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha