Sample calculation rules
Example 1
Example 1 - Calculation rules
Characteristic |
Description |
Description |
Using the CalcAge function, create a rule named rulCalcAge that calculates a subject's age and populates the age field. Use the DOV from the visit containing the DEM form. |
Scope |
Baseline study event |
Study structure |
|
Rule summary |
evaluate on Form Submission
value = !this.frmDOV.sctDOV.itmDOV.Empty && !this.frmDemographics.itmDOB.Empty ? 1 :(!this.frmDemographics.itmAGE.Empty ? 2:3)
when value == 1 set this.frmDemographics.itmAGE.Value = _CalcAge(this.frmDemographics.itmDOB.Value, this.frmDOV.sctDOV.itmDOV.Value)
when value == 2 set this.frmDemographics.itmAGE.Empty = true |
Example 2
Example 2 - Calculation rules
Characteristic |
Description |
Description |
Create a rule named rulBMIRangeCheck that checks that the BMI is between 18.5 and 30. Specify an action to issue a query if the BMI is out of range. |
Scope |
Baseline event |
Study structure |
|
Rule summary |
evaluate on Form Submission
value = (this.Value >= Constants.BMIRange.BMILow)&& (this.Value <= Constants.BMIRange.BMIHigh)
when value is false issue query on this: BMI {CalculatedBMI} is out of range. Please verify. |