- Posts: 40
- Thank you received: 1
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
- Topic Author
- Offline
- Senior Member
Less
More
5 years 10 months ago #169704
by DanielVN
Update age automatically using Equation type question, using Date of Birth was created 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.
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.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 10 months ago #169706
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on 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.
The topic has been locked.
- DanielVN
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 40
- Thank you received: 1
5 years 10 months ago #169707
by DanielVN
Replied by DanielVN on 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
Just wanted to double check before aplying this setup to the survey.
Cheers
Daniel
The topic has been locked.
- DanielVN
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 40
- Thank you received: 1
5 years 10 months ago #169830
by DanielVN
Replied by DanielVN on 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
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 10 months ago #169832
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on 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.
The topic has been locked.
- DanielVN
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 40
- Thank you received: 1
5 years 10 months ago #169833
by DanielVN
Replied by DanielVN on 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
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 10 months ago #169842
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on 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.
The topic has been locked.