In your scripts it will always be necessary to check conditions and depending on them execute other scripts. For this use an if-condition and add a condition inside the brackets. Compare values by using the following relational operators:
Operator |
Description |
== |
equal to |
!= |
not equal to |
< |
less than |
> |
greater than |
<= |
less than or equal to |
>= |
greater than or equal to |
Example:
// The script code surrounded by if {...} will only be executed if the condition is true!
if (jr_get_value(“decision”) == 1) {
//Add your script code here
}
In case you want to connect several conditions you can use the following operators:
Operator |
Description |
&& |
AND operator |
|| |
OR operator |
Additionally you can use brackets in case the condition is of a higher complexity.
Example:
if (jr_get_value(“decision”) == 1 || ( jr_get_value(„decision“) == 2 && jr_get_value("netamount“) < 1000.00 ) ) {
//Add your script code here
}
If you want to define what should happen in case a condition is not met, you can add an ELSE-condition.
Example:
// The script code surrounded by if {...} else {...} will only be executed if either the
// decision == 1, or the decision == 2 and the netamount < 1000.00 is!
if (jr_get_value(“decision”) == 1 || ( jr_get_value(„decision“) == 2 && jr_get_value("netamount“) < 1000.00 ) ) {
// Enter the script code you want to execute if the condition is true.
} else {
// Enter the script code you want to execute if the condition is not true.
}