Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Limit date range in functon of previous answers

  • limes4LN
  • limes4LN's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 months ago #113600 by limes4LN
Hi,

Can I set a limit of the date range in a date field according to previous answers. For example :

Question 1 : Are you an adult, teenager ou child ?
Question 2 : Your birthday please ? (if Q1=child, then possible answers for Q2 = 2014-01-01 < Q2 < 2004-01-01, if Q1=adult, then possible answers for Q2 = 1994-01-01 < Q2 < 1910-01-01; etc.)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 months ago #113605 by tpartner
I don't think you can use Expression Manager to set the minimum an maximum dates.

The simplest solution would probably be three separate "birthday" questions shown conditionally depending on the "age group" question.


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 months ago #113606 by tpartner
Oh, wait, I stand corrected. You can use EM in those settings - manual.limesurvey.org/Question_type_-_Da...9_.28New_in_2.05_.29

So, maybe something like this for the minimum date setting:
Code:
if(q1 == 1, '2004-01-01', if(q1 == 2, '1994-01-01', '1910-01-01'))

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose