Examples
JavaScript is case sensitive
Prefix a # to a variable code to indicate reference to a variable
Function |
Description |
---|---|
age(#birth); |
Gives the current age where #birth is the data export name for the birth date variable |
ageAsOf(#birth, #diagnosis); |
Gives the age at the date entered for variable #diagnosis |
st_calculateBmi(true, #hCm, #wKgs); |
Calculates BMI with #hCm height in centimeters and #wKgs weight in kilograms. |
st_calculateBmi(false, #hInch, #wLbs); |
Calculates BMI with #hInch height in inches and #wLbs weight in pounds. |
st_round(#var1, numberOfDecimalPlaces); |
Returns the value of var1 rounded to the number of decimal places indicated. |
st_isBetween(#var1, lowerBound, upperBound); |
Returns true if value of var1 is between lower and upper bound. |
#var1.enable(#var2 == 3); |
Enable #var1 if #var2 is equal to 3; if #var2 is not equal to 3, then variable #var1 will be disabled. Or use true or false in the parentheses. |
#var3.disable(); |
Disable #var3 |
#var1.showRow(#var2 == 3); |
Show #var1 if #var2 is equal to 3; if #var2 is not equal to 3, then variable #var1 will not display. Or use true or false in the parentheses. |
#var3.hideRow(); |
Hide #var3 |
#var3.showVariableGroup(#var4 == 1); |
Show the variable group containing variable #var3 if #var4 is equal to 1; if #var4 is not equal to 1, then the variable group containing variable #var3 will not be displayed. Or use true or false in the parentheses. |
if (#bgl < 70) #result.setValue(0); |
Sets the value of #result to 0 if variable #bgl is less than 70 |
if (#sex == 0){ #var5.style.background='blue';#var5.style.color='white'; |
If the variable #sex is 0, the background of variable #var5 will be set to blue, and the text color to white |
#var1.style.background = "green"; |
Sets the background color of #var1 to green Can use either the name of a basic color or any HTML hexadecimal notation
|
#var1.style.color = "white"; |
Sets the text color of #var1 to white |