Auto Populate Hidden Date Field For Statistics

More
9 months 1 week ago #187968 by ixtambay
Hi everyone!

I would like to ask if there is a way to auto populate a date field that is hidden so that when I view the statistics a date field would appear under response filters?

Thanks in advance!

Please Log in to join the conversation.

LimeSurvey Partners
More
9 months 1 week ago - 9 months 1 week ago #187972 by Joffm
Hi,
Unfortunately I was not successfull in entering something dynamic into the default answer option,
I used an equation to populate the date question.
Both hidden:
1. equation: {MyDate=date("Y-m-d")}
2. Hidden date question with code "MyDate"

And you have a date field in the response filter


Joffm

If you are going to populate with some other than the actual date, please tell us.


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 9 months 1 week ago by Joffm.

Please Log in to join the conversation.

More
9 months 1 week ago - 9 months 1 week ago #187977 by DenisChenu
For default value : {date("Y-m-d")} for date of today

With all data format. Since default value is set in PHP : must be SQL date

For another day/date : play with strtotime is the most easy.

For example : {date("Y-m-d",strtotime("tomorrow"))}

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 .
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 9 months 1 week ago by DenisChenu. Reason: {date("Y-m-d",strtotime("tomorrow"))}

Please Log in to join the conversation.

More
9 months 1 week ago #187986 by Joffm

For default value : {date("Y-m-d")} for date of today


Of course, I missed the curly brackets.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
9 months 1 week ago - 9 months 1 week ago #188104 by ixtambay
Thanks a lot sir Joffm and sir DenisChenu.

However, after trying it, the statistics shows the date (just like in the photo above) but why doesn't it save the date in the date field when I view it under survey responses.
Last edit: 9 months 1 week ago by ixtambay.

Please Log in to join the conversation.

More
9 months 1 week ago #188122 by Joffm
Hi, most probably you looked at the wrong place.

This value is stored.

It is stored exactly with the code of your "date" question.

Otherwise it couldn't be displayed in the statistics.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The following user(s) said Thank You: ixtambay

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now