Update age automatically using Equation type question, using Date of Birth

More
2 months 1 week ago #169704 by DanielVN
DanielVN created the topic: Update age automatically using Equation type question, using Date of Birth
Hi All,

I'm scripting a survey that I'm planning to run for years and to collect basic information for the respondents that will register in our Panel. I would like to use the attached example in order to collect respondents data age. So i would use a date/time question and then the information about the age will be calculated and stored in equation question.


The thing is that i would like to know if the data will be updated automatically using this setup. i.e. if a respondents have entered that is born on 31st of July 1981 the equation question is calculating correctly that the respondent is 36 y.o. After 31.07.2018 will the system change the calculation automatically to 37 y.o.?

Thank you very much in advance.

File Attachment:

File Name: Dateofbirth_EM.lss
File Size:17 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #169706 by tpartner
tpartner replied the topic: Update age automatically using Equation type question, using Date of Birth
Yes, it should because the time() variable is dynamic. It should be fairly easy to test though.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #169707 by DanielVN
DanielVN replied the topic: Update age automatically using Equation type question, using Date of Birth
Thank you very much, Tony.

Just wanted to double check before aplying this setup to the survey.

Cheers
Daniel

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #169830 by DanielVN
DanielVN replied the topic: Update age automatically using Equation type question, using Date of Birth
Hi,

I have tested this, however the script appears to not work.

I have tested the survey yesterday by answering that i was born on 13.06.2000. The script calculated correctly that i was 17 y.o. I have checked the data today but the date was still showing 17. I have ran new test answering that i was born on 13.06.2000 again and the script calculated that i'm 18 y.o.

Could you please advise what could be the reason for the script to not update the date automatically?

Thank you in advance.

Best regards
Daniel

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #169832 by tpartner
tpartner replied the topic: Update age automatically using Equation type question, using Date of Birth
No, the data will not change after being stored. I meant that the date is dynamic as the survey is taken (when the data is recorded).

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #169833 by DanielVN
DanielVN replied the topic: Update age automatically using Equation type question, using Date of Birth
Hi Tony,

Thank you. Is there a way to change the data once stored using some kind of script?

Best regards
Daniel

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #169842 by tpartner
tpartner replied the topic: Update age automatically using Equation type question, using Date of Birth
No, there is no way to do that from within LimeSurvey. I suppose you could use a remote PHP script to manipulate the database directly but that's out of the scope of this forum.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!