isStudyVersion( )

Compare the provided version with the current study version using the operator provided.

Syntax

isStudyVersion(operator, version)
isStudyVersion(operator, version, variable1, variable2, ...)

Parameters

operator

Can be any of the following: <, >, =, <=, >=.

variable

Variables that are used in the rule expression for the true condition.

Return value

Returns true or false, depending on the comparison result.

Example 3-78 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-79 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.