Note: The newer method, url_param
offers more flexibility and is preferred over getParm
.
getParm
is a method of capturing URL parameters. It is used within a variable and must be placed on the first page of a study. getParm
looks at the survey entry URL (entry link or invite link) to find the parameters it will use to populate data in the variable in which it is placed. It works for both closed-end and open-end data, and can be used multiple times on the same page with different variables to capture all necessary parameters from an entry URL.
Tip! For information on how to form your entry links to capture parameters, see Passing in parameters.
Examples
To grab information from a survey entry URL using getParm
, you must first set up a variable to capture the information and store it. Each individual parameter needs a variable to capture the value. The type of data being passed in will determine the type of variable you need to capture it. Use the getParm
expression with dvalue
or cvalue
to match and store the value from the parameter in the URL with the same name.
Open-end data
In the examples below the letter 'n' is used for the first name parameter, and the word 'pan' is used for the panel parameter. For example, passing in a first name requires a type: text
question to capture and store a string:
# Entry URL example
# http://servername.intellisurvey.com/pub/survey_ID/record_ID?n=Dakota
FIRSTNAME. First name passed in invisible: y type: text cvalue: getParm('n')
Closed-end data
Passing in a range of numeric values can be captured in a type: radio
question where each number can be used to classify information:
# Entry URL example
# http://servername.intellisurvey.com/pub/survey_ID/record_ID?n=Dakota&pan=1
PANEL. Panel Identifier invisible: y type: radio cvalue: getParm('pan') 1. Panel 1 2. Panel 2
These two examples would capture and store the first name and panel from the URL. QFIRSTNAME would contain 'Dakota', and QPANEL would contain a value of '1' for this record ID.
Usage with multi-select variables
To set a type: checkbox
question, you have to pass each parameter one at a time. The URL shown below will pass in three different fruit parameters. These have to be passed in separately since a checkbox is a multi-select question type. The example below will default the values of Q1 to options 2, 4, and 5, or Orange, Kiwi, and Apricot, respectively.
# Entry URL example
# http://servername.intellisurvey.com/pub/survey_ID/record_ID?fruit=2&fruit=4&fruit=5
1. Fruits type: checkbox invisible: y cvalue: getParm('fruit') 1. Apple 2. Orange 3. Banana 4. Kiwi 5. Apricot
Comments
0 comments
Please sign in to leave a comment.