- Posts: 6
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Date condition based on token attribute
- kateibe
- Topic Author
- Offline
- New Member
Less
More
10 years 8 months ago #98050
by kateibe
Date condition based on token attribute was created by kateibe
Hello,
I have a date questions which I need to compare to a token table attribute. For example:
Users will be asked to enter their Date of birth using a date question type (with dropdown boxes display) and with the input format left blank.
Then I would like to be able to compare this date entered to an attribute in the token table. I have tried everything but nothing seems to work!!
Since I left the input format in the date question type blank, I'm assuming this is defaulting to my survey format which is MM/DD/YYYY. In the Token attribute the date is set to the same format for example 03/20/1975. I'm not sure what else could be going on. Please help! Thank you!
Kat
I have a date questions which I need to compare to a token table attribute. For example:
Users will be asked to enter their Date of birth using a date question type (with dropdown boxes display) and with the input format left blank.
Then I would like to be able to compare this date entered to an attribute in the token table. I have tried everything but nothing seems to work!!
Since I left the input format in the date question type blank, I'm assuming this is defaulting to my survey format which is MM/DD/YYYY. In the Token attribute the date is set to the same format for example 03/20/1975. I'm not sure what else could be going on. Please help! Thank you!
Kat
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13907
- Thank you received: 2546
10 years 8 months ago #98055
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 Date condition based on token attribute
Hello,
You have to compare using : strtotime function: manual.limesurvey.org/Question_type_-_Date#Validation_on_date
Abd maybe for the date in token, use some string split to have a "pseudo" date.
Denis
You have to compare using : strtotime function: manual.limesurvey.org/Question_type_-_Date#Validation_on_date
Abd maybe for the date in token, use some string split to have a "pseudo" date.
Denis
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: kateibe
The topic has been locked.
- kateibe
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 years 8 months ago #98144
by kateibe
Replied by kateibe on topic Date condition based on token attribute
Hi Dennis,
Thank you for your response. Maybe this question is a bit out of my league because I cannot figure out how to make this work! It seems as though it would be so simple. I have tried everything, even using regular regex validation for a "short free type" question.
When I use the following: ^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$ nothing happens after the user enters a date...
I am not sure how strtotime would help in this case, and I am not sure what a "pseudo" date would look like. Any advice you can provide would be greatly appreciated. Thank you!
Kat
Thank you for your response. Maybe this question is a bit out of my league because I cannot figure out how to make this work! It seems as though it would be so simple. I have tried everything, even using regular regex validation for a "short free type" question.
When I use the following: ^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$ nothing happens after the user enters a date...
I am not sure how strtotime would help in this case, and I am not sure what a "pseudo" date would look like. Any advice you can provide would be greatly appreciated. Thank you!
Kat
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13907
- Thank you received: 2546
10 years 8 months ago #98159
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 Date condition based on token attribute
Put this in your token table YYYYMMDD (for a date of birth at 03/20/1975 : 19750320 ).
And use this validation equation:
date("YYYYMMDD",strtotime(self))==TOKEN:ATTRIBUTE_X
And use this validation equation:
date("YYYYMMDD",strtotime(self))==TOKEN:ATTRIBUTE_X
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: kateibe
The topic has been locked.
- kateibe
- Topic Author
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
10 years 8 months ago #98244
by kateibe
Replied by kateibe on topic Date condition based on token attribute
Hi Dennis,
Thank you for your help in this issue. It still didn't work but I figured out a work around by splitting the date into 3 different fields and adding 3 different attributes. Not the most elegant solution but it works. Thank you for your help anyways!
Kat
Thank you for your help in this issue. It still didn't work but I figured out a work around by splitting the date into 3 different fields and adding 3 different attributes. Not the most elegant solution but it works. Thank you for your help anyways!
Kat
The topic has been locked.