if(): map a score to a letter grade
Easy
Turn a score into a letter grade:
- 90 or above —
"A" - 75 to 89 —
"B" - 60 to 74 —
"C" - below 60 —
"F"
There is no else if. Nest the next if() in the false slot of the one before it.
Input
ri!score— Integer
ri! Rule Inputs
ri!scoreInteger82
Example 1 — Top band
Input: ri!score
95
Output:
"A"
Example 2 — Middle band
Input: ri!score
82
Output:
"B"
Example 3 — Lower boundary of C
Input: ri!score
60
Output:
"C"
Example 4 — Below every band
Input: ri!score
12
Output:
"F"
Example 5 — Boundary between A and B
Input: ri!score
90
Output:
"A"
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