- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Set the answer for one question based on answer to previous question
- chatthreads
- Topic Author
- Offline
- New Member
I know I can use the "equation" question type to store a value in the database using this:
{if(age<=24,'1',if(age<35,'2',if(age<=45,'3',if(age<=54,'4','5'))))}
But I need the value written to a hidden list (radio) question type.
Is there a way to do this with the new Expression Manager and relevance equations or do I need to use JavaScript?
Thanks in advance!
- chatthreads
- Topic Author
- Offline
- New Member
- Posts: 6
- Thank you received: 0
{if(age<=24,age_cat=='1',if(age<35,age_cat=='2',if(age<=45,age_cat=='3',if(age<=54,age_cat=='4',age_cat=='5'))))}
and then separately tried this too:
{if(age.NAOK<=24,age_cat.NAOK=='1',if(age.NAOK<35,age_cat.NAOK=='2',if(age.NAOK<=45,age_cat.NAOK=='3',if(age.NAOK<=54,age_cat.NAOK=='4',age_cat.NAOK=='5'))))}
... but neither of these work the way I want them to.
Any thoughts?
- TMSWhite
- Offline
- LimeSurvey Community Team
- Posts: 84
- Thank you received: 21
chatthreads wrote: I know I can use the "equation" question type to store a value in the database using this:
{if(age<=24,'1',if(age<35,'2',if(age<=45,'3',if(age<=54,'4','5'))))}
But I need the value written to a hidden list (radio) question type.
Why do you need it stored in a hidden list (radio) question type instead of just in an Equation question type (which will store the value to the database). So that you can use the statistics reporting options, or some other reason?
There isn't currently the ability to assign values (single equals sign) within EM, although it was designed to support that - that feature just hasn't been implemented yet.
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
- chatthreads
- Topic Author
- Offline
- New Member
- Posts: 6
- Thank you received: 0
- chatthreads
- Topic Author
- Offline
- New Member
- Posts: 6
- Thank you received: 0
- TMSWhite
- Offline
- LimeSurvey Community Team
- Posts: 84
- Thank you received: 21
So, perhaps a wish list for the future is to either extend the quota system, or add a "quota" advanced question attribute and let it support EM with some new extensions so that you can do the equivalent of:
db_count(q1,'==',5) < 100
To mean "only allow up to 100 responses where q1 == 5", or
db_count(q3 '<=' 4) < 50
To mean "only allow up to 50 responses where q3 <= 4"; or compound expressions.
Another advantage of this is that you could have quotas be applied with each page submission so that users can be exited out of the survey early, and not just at the very end.
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
- chatthreads
- Topic Author
- Offline
- New Member
- Posts: 6
- Thank you received: 0
- Mazi
- Offline
- Official LimeSurvey Partner
Correct! That's also quite a limitation when it comes to numeric questions e.g when aksing for the participants age. So being able to somehow use EM relevance statements would be a huge improvement.TMSWhite wrote: I just tried supporting equations within quotas, but it looks as though only enumerated choices in general (e.g. ones with answer lists rather than numeric or free text entry) can be supported by the quota system as designed).
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
- TMSWhite
- Offline
- LimeSurvey Community Team
- Posts: 84
- Thank you received: 21
TMSWhite wrote: There isn't currently the ability to assign values (single equals sign) within EM, although it was designed to support that - that feature just hasn't been implemented yet.
Actually, it turns out that that feature was implemented - just not fully tested. It will be available in the next 1.92+ release. So, you could use an EM expression to set the value for a different hidden variable.
If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser .
- Expression Manager (EM):
Documentation
|
Sample Surveys
|
How Tos
|
Show Logic File
|
Upgrading to 1.92+ - Excel Style for Survey Structure Import/Export
- Mazi
- Offline
- Official LimeSurvey Partner
Does some documentation and/or a sample survey already exist?
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
- chatthreads
- Topic Author
- Offline
- New Member
- Posts: 6
- Thank you received: 0
[attachment:1]limesurvey_survey_43373.lss[/attachment]
) is a very simple
one question survey that just asks age as a drop-down then the goal would be to have it be stored in the database as a hidden variable where the hidden question is a list (radio) style with "banded" options like 18-24, 25-34, 35-44, etc. which makes it easy to chart and run quotas from. But then there are much more complex ones where a user can be categorized as a certain type based on their responses to one or more questions. Normally we have to use Java Script to accomplish that.
- amoswagon
- Offline
- New Member
- Posts: 15
- Thank you received: 0
Thanks!
P.s. did you find a solution to your original question (setting and answer based on a previous question), I'm struggling with that as well.