Assert Condition
Verb: assert
Available from: <Enterprise>
Asserts the result of a condition and throws a message if the condition is false.
Syntax
assert --message(String) --left(Variant) --operator(ConditionalOperators) --right(Variant) [--negate(Boolean)]
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--message | Message | Required | Text | Message to show if condition is false. |
--left | Left Operand | Required | Any | Value or expression to evaluate. |
--operator | Operator | Required | ConditionalOperators | Rule used to evaluate the condition as true or false. Options:
|
--right | Right Operand | Only whenOperator is Equal_To, Greater_Than, Greater_Than_Equal_To, Less_Than, Less_Than_Equal_To, Contains, Ends_With, Begins_With, Matches | Any | Value responsible for evaluating the expression or parameter value Left Operand. |
--negate | Negate | Optional | Boolean | When enabled, denies the defined operation. |
Example
The Add to Collection command adds a new item "K" to a list that already has 4 items added. The Assert Condition command then throws the error message "List has more than 4 items".
defVar --name lettersList --type List --innertype String --value "[X,Y,Z,W]"
add --collection "${lettersList}" --value K
assert --message "The list does not have 4 items." --left "${lettersList.Count}" --operator "Equal_To" --right 4