This script will enable the storing of age in a hidden numeric question based on a date input into the Date question. Please note if you need this to be dynamic and update with time you should use recode questions.
Detailed Steps
- Create a Date question.
- Create a Numeric question and check the hidden property checkbox. You may want to temporarily leave this unhidden for testing or create a test instruction screen to pipe in the data (see "How Do I Set Up a Test Screen to Pipe Information from Hidden Questions").
- Copy the script below into Notepad.
- Edit AGE_QUESTION to be the name of your hidden Numeric question holding the age information.
- Edit DOB_QUESTION to be the name of your Date question.
- Insert the completed script into the Script section of the date question by doing the following:
- Select the Date question in the Questionnaire Tree.
- In the Scripting section of the page, click Edit Scripts.
- Paste the script into the On Exit tab.
- Click Save.
- Click Validate and test your survey.
Script:
/* Script Name: How do I store age based on a date question? To ensure your script works as expected, always copy the original script from the script library found in the support portal. Failure to use the most up to date script from the script library may cause unexpected results. */ Set(AGE_QUESTION,Panelist.Age(DOB_QUESTION.DateTimeValue));
More Information
For more information, see our webhelp topic Date question.
Comments
0 comments
Article is closed for comments.