isBetween: an inclusive quantity rule
Easy
An order line accepts a quantity from 10 to 20, both included. Return true when ri!quantity is allowed.
a!isBetween() is banned here, and that is the lesson: its range excludes both limits, so it cannot express this rule. Write the comparisons out.
Input
ri!quantity: Number (Integer)
Restrictions
Solve this without using a!isBetween().
ri! Rule Inputs
ri!quantityNumber (Integer)10
Example 1: The lowest allowed quantity
Input: ri!quantity
10
Expected output:
true
Example 2: The highest allowed quantity
Input: ri!quantity
20
Expected output:
true
Example 3: In the middle
Input: ri!quantity
15
Expected output:
true
Example 4: One below
Input: ri!quantity
9
Expected output:
false
Example 5: One above
Input: ri!quantity
21
Expected output:
false
Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter