GetValue
Appears as one of the following, depending on the type of the study object:
- GetValue(Integer)
- GetValue(Date)
- GetValue(String)
- GetValue(Float)
GetValue
Characteristic
Description
Icon
Availability
All items.
Return type and description
If the Empty property of the item is True—Returns the replacement value (a parameter of the method).
If the Empty property of the item is False—Returns the value of the item.
Syntax
(If rule is created on a study design)
StudyEventRefName.FormRefName.ItemRefName.GetValue(replacementValue)
Note: If the item is a child of a repeating study object, method information is included in the rule expression to indicate the item instance to which you are referring.
Parameters
- Parameter—replacementValue.
- Definition—The replacement value for the item.
- Data type—Data type of the item.
Example
If:
- Study event RefName is Death
- Form RefName is DeathForm
- Item RefName is RelatedToDevice
- Codelist item RefName that you specify for the parameter is RelatedCode3
Death.DeathForm.RelatedToDevice.GetValue(Death.DeathForm.RelatedToDevice.RelatedCodes.RelatedCode3)
Purpose
This method is useful for replacing a null value with a value that is usable for calculations, or for causing a rule to run even if a value has not been entered. For example, a BMI calculation typically does not run until the InForm user enters both a Height and Weight value for a subject. However, you can use this method to store a value of 0 in the BMI field if either Height or Weight is missing.
Below is a typical rule expression for calculating BMI:
value = this.itmHeight.Value != 0 ?
_CalculateBMI(this.itmWeight.Value, this.itmHeight.Value) : 0
This rule expression does not calculate the BMI until both values are present.
Below is the same expression, except it uses GetValue
value = this.itmHeight.GetValue(0) == 0 ?
_CalculateBMI(this.itmWeight.GetValue(0), this.itmHeight.Value) : 0
This expression calculates BMI upon submission of the form, regardless of whether the values for Height and Weight were entered.
In both cases, the expression checks whether Height is 0. If Height is 0, a divide-by-zero error occurs.