3/5

a!match(): tell a customer whether support is open

Medium

A help page shows the support desk's status. Days are numbered 1 (Monday) to 7 (Sunday) and hours 0 to 23:

  • Saturday or Sunday — "Closed for the weekend"
  • a weekday from 9:00 until 17:00 — "Open" (at 17:00 the desk has closed)
  • a weekday outside those hours — "Closed"
  • a day number outside 1 to 7 — "Invalid day"

A whenTrue condition can read other inputs as well as fv!value, and can be as rich as you need. Appian has no and or or operator — use the and() and or() functions.

Inputs

  • ri!day — Integer
  • ri!hour — Integer

ri! Rule Inputs

ri!dayInteger
3
ri!hourInteger
10

Example 1 — Mid-morning on a Wednesday

Input: ri!day
3
Input: ri!hour
10
Output:
"Open"

Example 2 — Opening time on a Monday

Input: ri!day
1
Input: ri!hour
9
Output:
"Open"

Example 3 — Closing time on a Friday

Input: ri!day
5
Input: ri!hour
17
Output:
"Closed"

Example 4 — Early on a Tuesday

Input: ri!day
2
Input: ri!hour
8
Output:
"Closed"

Example 5 — Saturday lunchtime

Input: ri!day
6
Input: ri!hour
12
Output:
"Closed for the weekend"

Example 6 — Sunday night

Input: ri!day
7
Input: ri!hour
3
Output:
"Closed for the weekend"

Example 7 — Day zero

Input: ri!day
0
Input: ri!hour
10
Output:
"Invalid day"

Example 8 — Day eight

Input: ri!day
8
Input: ri!hour
10
Output:
"Invalid day"

Appian Expression Tips

  • • Use ri!variableName for 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