- Posts: 55
- Karma: 2
- Thank you received: 10
Using hidden equation question to autofill an answer
- SurveyDennis
- Topic Author
- Offline
- Senior Lime
Less
More
2 years 1 month ago #127412
by SurveyDennis
Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com
SurveyDennis created the topic: Using hidden equation question to autofill an answer
Hi,
I am using the below instruction from the manual - Using hidden equation question to autofill an answer
Limesurvey Autofill
All working fine, except in my exmample it will always autofill the last option.
Even if I have selected a different answer then > 44.
I assume I just have a wrong typo somewhere or using the && wrong. But I don't see it, anyone that can help?
I am using the below instruction from the manual - Using hidden equation question to autofill an answer
Limesurvey Autofill
All working fine, except in my exmample it will always autofill the last option.
Even if I have selected a different answer then > 44.
I assume I just have a wrong typo somewhere or using the && wrong. But I don't see it, anyone that can help?
{DummyAge=if(Demographie2.NAOK < 16, DummyAge="A", if(Demographie2.NAOK > 15 && Demographie2.NAOK < 30, DummyAge="B", if(Demographie2.NAOK > 29 && Demographie2.NAOK < 45, DummyAge="C", if(Demographie2.NAOK > 44, DummyAge="D" ))))}
Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com
Please Log in to join the conversation.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 8728
- Karma: 400
- Thank you received: 1423
2 years 1 month ago - 2 years 1 month ago #127413
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
DenisChenu replied the topic: Using hidden equation question to autofill an answer
Hi,
Seems to have an error in the manual ....
Doingdon't work.
work.
Then :does the trick.
If you have some time to update the manual after testing. It can be great .
Done, but if you can improve it
Seems to have an error in the manual ....
Doing
{if(1,QCODE="A",QCOE="B")}
{QCODE=if(1,"A","B")}
Then :
{DummyAge=if(Demographie2.NAOK < 16, "A", if(Demographie2.NAOK > 15 && Demographie2.NAOK < 30, "B", if(Demographie2.NAOK > 29 && Demographie2.NAOK < 45, "C", if(Demographie2.NAOK > 44, "D" ))))}
Done, but if you can improve it
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: 2 years 1 month ago by DenisChenu.
The following user(s) said Thank You: SurveyDennis
Please Log in to join the conversation.
- SurveyDennis
- Topic Author
- Offline
- Senior Lime
Less
More
- Posts: 55
- Karma: 2
- Thank you received: 10
2 years 4 weeks ago - 2 years 4 weeks ago #127577
by SurveyDennis
Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com
SurveyDennis replied the topic: Using hidden equation question to autofill an answer
Sorry very late response, thank you for looking into this, need to test it later this week.
I used a different way to make it working, but your solution is better ofcourse:
I used a different way to make it working, but your solution is better ofcourse:
Be SurveyFriendly too
SurveyFriendly Designer [at] SurveyFriendly [dot] com
Last Edit: 2 years 4 weeks ago by DenisChenu. Reason: No need link
Please Log in to join the conversation.
- neraunzaran
- Offline
- Fresh Lemon
Less
More
- Posts: 3
- Thank you received: 0
9 months 3 weeks ago #147665
by neraunzaran
neraunzaran replied the topic: Using hidden equation question to autofill an answer
Hi guys, i'm kind of newbie on programming serious on LS.
I'm been trying to perform the same trick than SurveyDennis, i've already consult the link he provided.
Also tried to follow Denis Chenu recomendation, but i'm doing something wrong.
This is my equation:
{ QF2= if(QF1.NAOK<18, "1" if(QF1.NAOK>17 && QF1.NAOK<24, "2" if(QF1.NAOK>23 && QF1.NAOK<30, "3" if(QF1.NAOK>29 && QF1.NAOK<36, "4" if(QF1.NAOK>35 && QF1.NAOK<43, "5" if(QF1.NAOK>42 && QF1.NAOK<50, "6" if(QF1.NAOK>49 && QF1.NAOK<58, "7" if(QF1.NAOK>57 && QF1.NAOK<65, "8" if(QF1.NAOK>64, "9"))))))))) }
where QF1-> ask for age. then i need to generate 9 different categories.
Could you guide me on what i'm doing wrong. If you can provide a file with example, i will be in great debt with you.
Thanks in advance and best regards from mexico.
I'm been trying to perform the same trick than SurveyDennis, i've already consult the link he provided.
Also tried to follow Denis Chenu recomendation, but i'm doing something wrong.
This is my equation:
{ QF2= if(QF1.NAOK<18, "1" if(QF1.NAOK>17 && QF1.NAOK<24, "2" if(QF1.NAOK>23 && QF1.NAOK<30, "3" if(QF1.NAOK>29 && QF1.NAOK<36, "4" if(QF1.NAOK>35 && QF1.NAOK<43, "5" if(QF1.NAOK>42 && QF1.NAOK<50, "6" if(QF1.NAOK>49 && QF1.NAOK<58, "7" if(QF1.NAOK>57 && QF1.NAOK<65, "8" if(QF1.NAOK>64, "9"))))))))) }
where QF1-> ask for age. then i need to generate 9 different categories.
Could you guide me on what i'm doing wrong. If you can provide a file with example, i will be in great debt with you.
Thanks in advance and best regards from mexico.
Please Log in to join the conversation.
9 months 3 weeks ago #147670
by elissa
Elzbieta Lesinska
LS Polish translator and supervisor
elissa replied the topic: Using hidden equation question to autofill an answer
Hi,
At first glance there are commas (,) missing before successive "if" commands.
Cheers
At first glance there are commas (,) missing before successive "if" commands.
Cheers
Elzbieta Lesinska
LS Polish translator and supervisor
The following user(s) said Thank You: DenisChenu
Please Log in to join the conversation.
9 months 3 weeks ago #147671
by Ben_V
Good catch Elissa...
I think it could be something like:
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Ben_V replied the topic: Using hidden equation question to autofill an answer
elissa wrote: At first glance there are commas (,) missing before successive "if" commands.
Good catch Elissa...
I think it could be something like:
{ QF2 =
if (QF1.NAOK < 18, "1",
if (QF1.NAOK > 17 && QF1.NAOK < 24, "2",
if (QF1.NAOK > 23 && QF1.NAOK < 30, "3",
if (QF1.NAOK > 29 && QF1.NAOK < 36, "4",
if (QF1.NAOK > 35 && QF1.NAOK < 43, "5",
if (QF1.NAOK > 42 && QF1.NAOK < 50, "6",
if (QF1.NAOK > 49 && QF1.NAOK < 58, "7",
if (QF1.NAOK > 57 && QF1.NAOK < 65, "8", "9"))))))))
}
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Please Log in to join the conversation.