isStudyVersion( )
Compare the provided version with the current study version using the operator provided.
Syntax
isStudyVersion(operator, version)
isStudyVersion(operator, version, variable1, variable2, ...)
Parameters
Parameter | Required/Optional | Description |
---|---|---|
operator |
Required | Operator to compare the current study version with a
given value.
Can be any of the following:
|
version |
Required | Version number to compare the current study version with. |
variable |
Optional | Variables that can be used in the rule expression given a true condition (if the comparison scenario is true). |
Return value
Boolean (true or false) value, depending on the comparison result.
Examples
Example 3-80 Example 1
//If Study Version is >= 1.0.0.5, multiply num1 by 10. Otherwise just return num1.
if (isStudyVersion(">=", "1.0.0.5")) {
return num1*10;
} else {
// Do something else
return num1;
}
Example 3-81 Example 2
If( isStudyVersion(">","10.1.2", variable1, variable2, variable3) ) {
//do something
return variable1 + variable2 + variable3;
} else {
If( isStudyVersion("<=","10.1.2", variable1, variable2) )
//do something else
return variable1 + variable2;
}
}
Note:
- isStudyVersion( ) with two parameters doesn't cover the situation where item data is cleared or never entered. You can take care of this case by comparing variables with an empty value and writing your own code for such a situation. (For example,
if (var) { //do something}
). - isStudyVersion( ) with more than two parameters lets a rule behave similar to standard rule behavior for the situation where data is cleared or never entered. In this case, no extra action is required.
- If isStudyVersion( ) is used with more than two parameters, use an
else
condition as shown in Example 2.
Parent topic: Control the behavior of a rule