- Posts: 29
- Thank you received: 7
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Getting an Expression Manager script from 5.x to work in 3.x
1 year 3 weeks ago #225709
by Leithy
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.x and 3.x
Own server or LimeSurvey hosting: Own
Survey theme/template:
==================
I'm unable to get the following EM script to work in 3.x but it works fine in 5.x - appreciate very much any ideas you all might have why!:
In 5.x the question type is equation, display:none, mandatory but in 3.x the question type is short free text, display:none, mandatory.
A javascript console dump suggests TOKEN:ATTRIBUTE_1; TOKEN:ATTRIBUTE_2 and defaultExpiryDays are populating successfully
Your LimeSurvey version: 5.x and 3.x
Own server or LimeSurvey hosting: Own
Survey theme/template:
==================
I'm unable to get the following EM script to work in 3.x but it works fine in 5.x - appreciate very much any ideas you all might have why!:
Code:
if(TOKEN:ATTRIBUTE_1 != "Yes" && is_empty(TOKEN:ATTRIBUTE_2), defaultExpiryDays, if(TOKEN:ATTRIBUTE_1 != "Yes" && TOKEN:ATTRIBUTE_2 > 0, TOKEN:ATTRIBUTE_2, 365 * 5))
In 5.x the question type is equation, display:none, mandatory but in 3.x the question type is short free text, display:none, mandatory.
A javascript console dump suggests TOKEN:ATTRIBUTE_1; TOKEN:ATTRIBUTE_2 and defaultExpiryDays are populating successfully
Please Log in to join the conversation.
- DenisChenu
-
- Away
- LimeSurvey Community Team
-
Less
More
- Posts: 12900
- Thank you received: 2371
1 year 3 weeks ago #225710
by DenisChenu
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.
Replied by DenisChenu on topic Getting an Expression Manager script from 5.x to work in 3.x
The expression don't seems to have specific part for 5.X
But : with short free text question type : you don't fille answer. Equation quetsion typoe fill answer.
Can you explain what you want.
But : with short free text question type : you don't fille answer. Equation quetsion typoe fill answer.
Can you explain what you want.
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.
The following user(s) said Thank You: Leithy
Please Log in to join the conversation.
1 year 3 weeks ago #225711
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Getting an Expression Manager script from 5.x to work in 3.x
Sorry,
why are there different question types?
Usually you want to store the result of this into a variable (the QuestionCode).
And therefore you use a question of type "equation".
If you want to enter this result into a question of type "short text" you might enter the equation into the default answer.
So we don't exactly know what you want to do with that equation.
Joffm
why are there different question types?
Usually you want to store the result of this into a variable (the QuestionCode).
And therefore you use a question of type "equation".
If you want to enter this result into a question of type "short text" you might enter the equation into the default answer.
So we don't exactly know what you want to do with that equation.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, Leithy
Please Log in to join the conversation.
1 year 3 weeks ago #225717
by Leithy
Replied by Leithy on topic Getting an Expression Manager script from 5.x to work in 3.x
Thanks for the speedy response Denis.
In 5.x the script works as expected but in 3.x the script produces an empty result. I don't understand why...
The script is designed to produce an expiry date, measured in length of time:
- It returns a 'never expire' value of 365 x 5 days if TOKEN:ATTRIBUTE_1 is to "Yes"
- It returns a a custom expiry date if TOKEN:ATTRIBUTE_2 has been set for the particular participant
- Or it returns defaultExpiryDays if the other variables aren't set
It works just fine in 5.x but in 3.x returns an empty value.
Expression Manager parses the script correctly.
In 5.x the script works as expected but in 3.x the script produces an empty result. I don't understand why...
The script is designed to produce an expiry date, measured in length of time:
- It returns a 'never expire' value of 365 x 5 days if TOKEN:ATTRIBUTE_1 is to "Yes"
- It returns a a custom expiry date if TOKEN:ATTRIBUTE_2 has been set for the particular participant
- Or it returns defaultExpiryDays if the other variables aren't set
It works just fine in 5.x but in 3.x returns an empty value.
Expression Manager parses the script correctly.
Please Log in to join the conversation.
1 year 3 weeks ago - 1 year 3 weeks ago #225719
by Leithy
Replied by Leithy on topic Getting an Expression Manager script from 5.x to work in 3.x
Thanks Joffm
If I'm correct only 5.x contains the the question type "Equation"?
In which case I need to use another type in 3.x (ie short-text?)
EDIT: Your suggestion worked many thanks! - just needed to put the script into Default Answer. Been working with 5.x for too long forgot how it worked in 3.x!
If I'm correct only 5.x contains the the question type "Equation"?
In which case I need to use another type in 3.x (ie short-text?)
EDIT: Your suggestion worked many thanks! - just needed to put the script into Default Answer. Been working with 5.x for too long forgot how it worked in 3.x!
Last edit: 1 year 3 weeks ago by Leithy. Reason: Added answer
Please Log in to join the conversation.
1 year 3 weeks ago #225726
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Getting an Expression Manager script from 5.x to work in 3.x
The question type equation exists since 2.0x if not since 1.9x. So there is definitely the question type equation in LS 3.x. No need to use some other question type than equation.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: DenisChenu, Leithy
Please Log in to join the conversation.