Summary

This article describes how to allow a defined question to automatically be assigned a value. 


Table of Contents


This worksheet allows a defined question to automatically be assigned a value. Assignments can define custom expressions related to specific questionTypeIds. An Assignment takes a value and enters it in a question (blank data point). Assignments can be written as standard expressions to store values. Typically, Assignments are used on questions of type PlainText. However, Text can be used if the system should allow the user to override the calculated value. Assignments are used to internally and dynamically calculate a question’s value, which is very useful in calculating survey scores, etc.

Limitation: The product of the expression can only be evaluated when the form on which the formula is calculated is saved. If an Assignment is associated on two forms, and the value changes on one form, the form containing the BMI must be resaved, or the assignment will not change.

All assignments should have the questions on which they are dependent on the same form.


Custom assignments and scripts are intended for one-to-many relationships.

questionTypeId

The questionTypeId entered for assignments should be associated with the questionTypeId found on the Question Types – Definition worksheet. This questionTypeId will have the data assignment populated as its answer when the assignment is executed.

Expression Type

This determines whether the expression will be evaluated as standard expression (written in DataCollector expression language) or executed as a custom class. If the expression is custom, enter ‘custom’ for the field; if it is a standard expression, leave the Expression Type field blank.

Expression

When the Expression Type is set to ‘custom’, this field will contain the class name to be executed for the assignment. If the assignment needs to reference a formula, enter the formulaId.

If the Expression Type field is blank, the expression field will contain the expression for the assignment. The expression is the desired value. A relative or absolute addressing expression must be created to evaluate the data criteria. It is best to use absolute addressing with formulas.

Data Values & Display Values

Question paths within expressions can be written to account for data values (the actual value stored in the database) or display values (the display label associated with a data value). To reference a data value, simply add .dataValue to the end of the question path. To reference a display value, simply add .displayValue to the end of the question path.

Example 1: Data Value
#studyTermination.visitDateTerm.dataValue
Example 2: Display Value
#studyTermination.visitDateTerm.displayValue


Need more help?

Please visit the Fountayn Contact Information page.