Structure Elements for Calculated Fields
To implement complex algorithms (e.g. Security - Incident - CVSS 3.1 (CVSS Calculation explained )) you can use the following structural elements.
if condition
Allows you to compare expression1 with expression2 using a condition.
an expression is a single-line expression which can contain these operators. Operators for Calculated Fields
you can use the following conditions
>
>=
==
<=
<
!=
the if sections cannot be nested
the Else section is optional
Structure
#if (expression1) condition (expression2) {
// one or more lines
} else {
// one or more lines
}
Example
#if (scope) == (1) {
#variableImpact(6.42 $variableISS *)
} else {
#variableImpact(7.52 $variableISS 0.029 - * 3.25 $variableISS 0.02 - 15 ^ * -)
}
return declaration
Returns the result of the expression . the following elements are ignored
Structure
#return(expression)
Example
variable definition
Defines a variable which you can access in the following lines
Structure
Example
variable usage
Returns the value of a variable and can be used within expressions
Structure
Example
or combined with variable definition