Question text depending on tokens and/or prior answers

More
3 years 3 weeks ago #122876 by FranzGerbig
FranzGerbig created the topic: Question text depending on tokens and/or prior answers
Hi folks,

how may I present one out of two different question texts asking for the same numerical input - depending on tokens and/or answers to prior questions?
What I've been trying (and struggling with - don't mind the fictitious text examples but the syntax):

{If(q01 != 01) OR If(q02 == 01) "How many parents do you know?"}
{If(q01 == 01) "How many people do you know?"}

Please enter some number.

Thanks a lot

using LS 3.13.2+180709

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122879 by gabrieljenik
gabrieljenik replied the topic: Question text depending on tokens and/or prior answers
Please, see the IF function syntax in the following EM function list: manual.limesurvey.org/Expression_Manager#Implemented_Functions

Cheers,
Gabriel - www.Encuesta.Biz - Authorized Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?)....[img]
The following user(s) said Thank You: FranzGerbig

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122886 by FranzGerbig
FranzGerbig replied the topic: Question text depending on tokens and/or prior answers
sorry but I can't help it, still.

If(q01 != 01 or q02 == 01, "How many parents do you know?",
If(q01 == 01, "How many people do you know?",""),"")

The syntax if(test,result_if_true,result_if_false) applied to my case:
test (based on different questions each):
q01 != 01 or q02 == 01
result_if_true:
"How many parents do you know?"
result_if_false:
"How many people do you know?" - but only If(q01 == 01)
result_if_false (that is: none of above mentioned tests true):
Hide question!

As you see, I need to kind of combine relevance (works) and tailoring (doesn't work) - Can I do this with LimeSurvey?

Greets

using LS 3.13.2+180709

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122887 by gabrieljenik
gabrieljenik replied the topic: Question text depending on tokens and/or prior answers
Which error are you getting?
As per " I need to kind of combine relevance (works) and tailoring", you would need to use 2 expressions at relevance equation and also for tailoring.

Cheers,
Gabriel - www.Encuesta.Biz - Authorized Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?)....[img]
The following user(s) said Thank You: FranzGerbig

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122888 by FranzGerbig
FranzGerbig replied the topic: Question text depending on tokens and/or prior answers
any, I don't get any error :huh: :blink:

using LS 3.13.2+180709
Attachments:

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122892 by gabrieljenik
gabrieljenik replied the topic: Question text depending on tokens and/or prior answers
And what is what you get as output?

Cheers,
Gabriel - www.Encuesta.Biz - Authorized Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?)....[img]

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122911 by FranzGerbig
FranzGerbig replied the topic: Question text depending on tokens and/or prior answers
Hi Gabriel,

you mean, how the question appears on the survey page?
Well, the If(...) syntax appears as plain text in the question field (see attached jpg). Is this what you were asking for?
(However, the relevance equation works.)

Thanks for your engagement
bilo

using LS 3.13.2+180709
Attachments:

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122932 by gabrieljenik
gabrieljenik replied the topic: Question text depending on tokens and/or prior answers
About the formula locatd in the question texy, are you surronunding it with curly braces?
Also, please, check about case of the "if" function.

Cheers,
Gabriel - www.Encuesta.Biz - Authorized Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?)....[img]
The following user(s) said Thank You: FranzGerbig

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122948 by FranzGerbig
FranzGerbig replied the topic: Question text depending on tokens and/or prior answers
Hi Gabriel,

sorry - the very first time I entered the syntax with curly braces, LimeSurvey responded no valid syntax, so I took them out :whistle: :blush: .
Now, I noticed that the error was I had put "If" instead of "if". So now syntax with curly braces is OK, but doesn't work effectively.
... And after noticing that (using the default Yes/No-question type) "Yes" is the 'Y' and "No" is saved as 'N' (instead of 1 and 2) in the response data, the correct wording is presented for the correct condition.
Now it works perfectly - even with two "if"
{if(q01 == 'Y' or q02 == 'A1', "How many parents do you know?", "How many people do you know?")}

Muchas gracias - que estés muy bien
bilo

using LS 3.13.2+180709

Please Log in or Create an account to join the conversation.

More
3 years 3 weeks ago #122955 by gabrieljenik
gabrieljenik replied the topic: Question text depending on tokens and/or prior answers
Great!

Cheers,
Gabriel - www.Encuesta.Biz - Authorized Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?)....[img]

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!