Skip to main content
2/5

if(): map a score to a letter grade

Easy

Turn a score into a letter grade:

  • 90 or above is "A"
  • 75 to 89 is "B"
  • 60 to 74 is "C"
  • below 60 is "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!scoreInteger
82

Example 1: Top band

Input: ri!score
95
Expected output:
"A"

Example 2: Middle band

Input: ri!score
82
Expected output:
"B"

Example 3: Lower boundary of C

Input: ri!score
60
Expected output:
"C"

Example 4: Below every band

Input: ri!score
12
Expected output:
"F"

Example 5: Boundary between A and B

Input: ri!score
90
Expected output:
"A"

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