Set conditional statement
if ... then ... else ... end
if ... then ... else ... endto specify an if-then-else conditional statement that has Ninox check whether a sequence of statements should be executed (if... then...) or what should happen when the input condition is not met (... else...).
The if statement must be an expression that is either
The use of comparison operators, such as greater than (
>=), less than (
<=) or equal to (
=) is also suitable for this purpose.
Depending on the result of the comparison, the further procedure is determined.
Create a Total field (number field type), type the following script in a formula field, and vary the value to Total:
if Total >= 30 then "Card" else "Cash" end
Result: If the entered value in the Total field is greater than or equal to €30, payment is made by Card, otherwise payment is made in Cash.
You don't need to specify an alternative sequence, e.g., an
else. This means that a statement is either executed or not.
let paymentMethod := "Cash";
if Total >= 30 then
paymentMethod := "Card"
paymentMethodis set to Cash by default. However, if the value in the Total number field is greater than €30, the value for
paymentMethodis updated to Card.
nullto check whether a data field is empty. So
nulldoes not stand for 0, but for empty. Combined with a branch, it allows you to execute a script even when a field is empty.
if Total = null then
"Please enter an amount!"
Result: If the Total field is empty, a prompt (
"Please enter an amount!") is displayed.