- Posts: 72
- Thank you received: 10
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Using hidden equation question to autofill an answer
- SurveyDennis
- Topic Author
- Offline
- Senior Member
Less
More
8 years 5 months ago #127412
by SurveyDennis
Be SurveyFriendly too! Fight against boring surveys! www.SurveyFriendly.com
Using hidden equation question to autofill an answer was created by SurveyDennis
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?
Code:
{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! Fight against boring surveys! www.SurveyFriendly.com
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13912
- Thank you received: 2549
8 years 5 months ago - 8 years 5 months 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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Using hidden equation question to autofill an answer
Hi,
Seems to have an error in the manual ....
Doing
don't work.
work.
Then :
does the trick.
[strike]If you have some time to update the manual after testing[/strike]. It can be great .
Done, but if you can improve it
Seems to have an error in the manual ....
Doing
Code:
{if(1,QCODE="A",QCOE="B")}
Code:
{QCODE=if(1,"A","B")}
Then :
Code:
{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" ))))}
[strike]If you have some time to update the manual after testing[/strike]. It can be great .
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 , plugin development .
I don't answer to private message.
Last edit: 8 years 5 months ago by DenisChenu.
The following user(s) said Thank You: SurveyDennis
The topic has been locked.
- SurveyDennis
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 72
- Thank you received: 10
8 years 4 months ago - 8 years 4 months ago #127577
by SurveyDennis
Be SurveyFriendly too! Fight against boring surveys! www.SurveyFriendly.com
Replied by SurveyDennis on 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! Fight against boring surveys! www.SurveyFriendly.com
Last edit: 8 years 4 months ago by DenisChenu. Reason: No need link
The topic has been locked.
- neraunzaran
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 1 month ago #147665
by neraunzaran
Replied by neraunzaran on 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.
The topic has been locked.
- elissa
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 195
- Thank you received: 70
7 years 1 month ago #147670
by elissa
Elzbieta Lesinska
LS voluntary Polish translator and supervisor
Replied by elissa on 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 voluntary Polish translator and supervisor
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1223
- Thank you received: 351
7 years 1 month 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)
Replied by Ben_V on 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:
Code:
{ 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)
The topic has been locked.