- Posts: 61
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Question text depending on tokens and/or prior answers
- FranzGerbig
- Topic Author
- Offline
- Senior Member
Less
More
8 years 7 months ago #122876
by FranzGerbig
using LS 3.13.2+180709
Question text depending on tokens and/or prior answers was created by FranzGerbig
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
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
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
8 years 7 months ago #122879
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on 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
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The following user(s) said Thank You: FranzGerbig
The topic has been locked.
- FranzGerbig
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
8 years 7 months ago #122886
by FranzGerbig
using LS 3.13.2+180709
Replied by FranzGerbig on 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
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
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
8 years 7 months ago #122887
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on 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.
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.
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The following user(s) said Thank You: FranzGerbig
The topic has been locked.
- FranzGerbig
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
8 years 7 months ago #122888
by FranzGerbig
using LS 3.13.2+180709
Replied by FranzGerbig on 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:
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
8 years 7 months ago #122892
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on topic Question text depending on tokens and/or prior answers
And what is what you get as output?
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The topic has been locked.
- FranzGerbig
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
8 years 7 months ago #122911
by FranzGerbig
using LS 3.13.2+180709
Replied by FranzGerbig on 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
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:
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
8 years 7 months ago #122932
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on 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.
Also, please, check about case of the "if" function.
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The following user(s) said Thank You: FranzGerbig
The topic has been locked.
- FranzGerbig
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 61
- Thank you received: 0
8 years 7 months ago #122948
by FranzGerbig
using LS 3.13.2+180709
Replied by FranzGerbig on 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
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
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
8 years 7 months ago #122955
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on topic Question text depending on tokens and/or prior answers
Great!
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The topic has been locked.