Welcome to the LimeSurvey Community Forum

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

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

  • DanielVN
  • DanielVN's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 10 months ago #169704 by DanielVN
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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169706 by tpartner
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.
The topic has been locked.
  • DanielVN
  • DanielVN's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 10 months ago #169707 by DanielVN
Thank you very much, Tony.

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

Cheers
Daniel
The topic has been locked.
  • DanielVN
  • DanielVN's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 10 months ago #169830 by DanielVN
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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169832 by tpartner
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.
The topic has been locked.
  • DanielVN
  • DanielVN's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 10 months ago #169833 by DanielVN
Hi Tony,

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

Best regards
Daniel
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #169842 by tpartner
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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose