Using a lookup on a questionnaire
Using lookups to provide the options for text selection variables
Lookups can provide the selection options for text selection variables. This is particularly useful when the selection list is large or is re-usable across many variables.
For example, the dynamic options of a select variable
TargetTimeZone
:
Distinct( Select 'Time Zone' )
Note the use of the function
Distinct
. This is necessary because the lookup table contains duplicate entries. All unique entries from the column Time Zone in the above lookup table will be added as selection options for the TargetTimeZone variable.
Filtering the values of a lookup
Dynamic lookups also offer a way of varying the selection options offered, based on an answer to an earlier question.
For example, the dynamic options of a select variable
TargetState
which is restricted to those states in the
Sometimes it is useful to display selection options that differ from the values you wish to store for a variable
:
Select 'State Name' Where 'Time Zone' Is TargetTimeZone
Using lookups to display different selection wording to the answer values
Sometimes it is useful to display selection options that differ from the values you wish to store for a variable.
For example, you may wish to use a short code as the answer for a US State, but display the full name of the State for a user to choose from. To achieve this for the
TargetState
above its dynamic options are defined as:
Select 'State Code', 'State Name' Where 'Time Zone' Is TargetTimeZone
When the select expression references two column names the first column represents the actual value of the variable and the second column represents the options that appear on the questionnaire. If a questionnaire user chooses Arizona, for example, the value of the
TargetState
variable will be "AZ".
This means not only will this value go into the generated document but also if you have other business rules referencing the answer to this variable they must use the first column you state in the Select statement too:
[
TargetState IS "AZ"
This Agreement is subject to the laws of {TargetState.'State Name'} ({TargetState})]
Using lookups to display information on a questionnaire
A lookup provides an easy way to make the text on a questionnaire page change automatically (see
active text), based on a questionnaire user's answers. It can be used in prompts, guidance, page titles or group titles. You can use either the full form or abbreviated form of the lookup (as above).
For example for the Guidance of the Jurisdiction question we might want to remind the user of the currency that is going to be used for the Agreement as a result of their selection. Therefore in the Guidance area of the Jurisdiction variable's attributes we might have:
The Currency of this Agreement is {Select CurrencyName Where Country Is Jurisdiction} ({Select CurrencySymbol Where Country Is Jurisdiction}).