Check out the LimeSurvey source code on GitHub!

Calculated value from numeric

More
5 years 3 months ago #68993 by ulysse68
Hi all!

Is it possible to display a value calculated from a previous entry? For example, I ask the birth year, and on the next screen, I want to display the age of the person, to be sure there haven't been any mistake. I didn't find that in the replacing fields -- I can display the entry, but not compute data.

Thanks for your hints!
U.

Please Log in to join the conversation.

More
5 years 3 months ago #69001 by Mazi
Such a feature doesn't exist yet but at the next Limesurvey version there will be a complex Expression Manager that should be able to handle such cases, see docs.limesurvey.org/Expression+Manager+HowTos .

As a temporary workaround you can place both questions on the same page and use some Javascript to calculate the age.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"
The following user(s) said Thank You: ulysse68

Please Log in to join the conversation.

More
5 years 3 months ago #69003 by tpartner

As a temporary workaround you can place both questions on the same page and use some Javascript to calculate the age.


Or leave the questions on separate pages. In page 2, use {INSERTANS} to retrieve the entered date value and then do the calculation with JavaScript and display the age.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ulysse68

Please Log in to join the conversation.

More
5 years 3 months ago #69004 by ulysse68
Thanks to both of you!
U.

Please Log in to join the conversation.

More
5 years 3 months ago #69018 by Mazi

ulysse68 wrote: Thanks to both of you!
U.

You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 3 months ago - 5 years 3 months ago #69082 by macmariner
Can anyone supply any example javascript code.

Sorry, I know nothing about writing javascript code.

Thanks
Last Edit: 5 years 3 months ago by macmariner. Reason: spelling, doh!!

Please Log in to join the conversation.

More
5 years 3 months ago #69103 by Mazi
If you create a simple Demo survey and link it here we can give some advice.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form