Hi
We have a survey where we want to calculate age at an event using date of birth.
We already know the user's DOB before we start the survey, saved in our database.
Can we pass the DOB into the survey as a parameter, to avoid asking it again?
Or is there another way to pull it from the database with a custom function?
Using external data in a survey
Show previous comments
(0)
Comments
(0)
Sign in to comment on this post
Answers approved by surveyjs Support
Hello Archie,
Sure, you can use a variable. Here is the example to set the variable: survey.setVariable("age", yourAgeValue)
. After that you can use this "age" variable in expressions like a question value, for example, visibleIf: "{age} > 23"
.
Please note, variables are not store in survey.data.
Thank you,
Andrew
SurveyJS Team
Comments
(2)
Thanks Andrew, but I don;t understand how I am going to set the different values of "yourAgeValue" for each user?
AT
3 years ago
It is a different session on your server for your users and you can render a different code for Survey Library.
There are many ways to implement this and it is mostly depends on your server platform and your needs.
Thank you,
Andrew
SurveyJS Team