Day 19: Using Variables in the Question Prompt
Previous Topic  Next Topic 

In the last lesson we asked you to use IF ELSE logic in the CALCULATION question to generate more complex messages. If you have not done that, go back and do it now before continuing with this lesson.


This lesson will show you how to use variables in the question prompt, displaying question answers in later questions as you progress through the survey.


Note



Now do the following.


    1. Create a new survey and save it “Day 19”. In the MAIN SECTION create a FORM type SECTION with the question prompt PERSONAL DETAILS.


    1. In PERSONAL DETAILS create a simple TEXT question called “Name”. In the TEXT CONVERSATION menu select Title Case so that the first letter in every word will be uppercase. Click INSERT.


    1. Add a TIME question named “Date of Birth”. Select INPUT DATE from the list and INSERT the question.


    1. Add a MENU question to the PERSONAL DETAILS section with the question prompt “Gender”. Add two choices “Male” and “Female”. Check that all questions in PERSONAL DETAILS are being sent to the SINGLE ITEM file.


    1. In the MAIN section create a MENU question named “Wine Type” with two menu choices of “red” and “white”. Be sure to check the casing and spelling of each question prompt and menu choice, as these variables will later be summoned and displayed in other question prompts and messages. INSERT this question so that it follows on from PERSONAL DETAILS.


    1. Now create a NUMBER question with the question prompt, “How many bottles of {{Wine Type}} wine do you drink per month?”. Select an OPTIONAL size check from 0 – 100 using SPIN BUTTONS. You need to be able to summon this question as a variable later in this survey. Creating a DATA NAME would make this process a lot more efficient and leave less room for error. Enter a DATA NAME of “Quantity”.


    1. Create a MENU question with the question prompt “Do regularly drink {{Quantity}} bottles of {{Wine Type}} wine per month?”. Add two choices of “Yes” and “No”. Give this question a data name “Regular”.


    1. Add a CALCUATION question with the question prompt named “Wine Choice”. IF ELSE logic is needed to determine which message will be displayed at the end of your survey. If the answer to the question “Regular” is YES, you need to make it clear that you drink this amount of wine regularly. Otherwise it will be clear that you only usually drink that amount of wine. Add the following expression:


            IF ({{Regular}} = "Yes") "You regularly drink"

ELSE "You occasionally drink"


    1. The final question will be a message that summarises your wine preference and consumption per month. Create a MESSAGE question with the question prompt “Message”. Make sure the DATA DESTINATION FILE is set to NONE. In the TEXT TO DISPLAY box enter the following text:


{{Wine Choice}} {{Quantity}} bottles of {{Wine Type}} wine per month.


    1. SAVE and RUN your survey on the HANDHELD, enter a SURVEY IDENTIFIER and fill out the personal details form. Select a WINE TYPE. You should now be able to see that the wine type you selected is displayed in the following question. Select how many bottles of wine you drink per month. Now you should see both question answers for QUANTITY and WINE TYPE shaping the next question. Select YES or NO and you will finish the survey with a pop up message informing you of your preferred wine type, the amount you drink per month and whether your drinking is regular or occasional.


The next lesson will show you how to use the Internet to connect your desktop and handheld device.

HandHeld Systems Ltd ©