3/5

a!update(): blank out the scores below a threshold

Medium

Return the scores with every value below ri!minimum replaced by the text "n/a". Scores at or above it are untouched, and the list keeps its length.

where() gives you exactly the positions to change, and one replacement value covers all of them.

Inputs

  • ri!scores — List of Integer
  • ri!minimum — Integer

ri! Rule Inputs

ri!scoresList of Integer
{
  90,
  40,
  70,
  10
}
ri!minimumInteger
60

Example 1 — Two below the line

Input: ri!scores
{
  90,
  40,
  70,
  10
}
Input: ri!minimum
60
Output:
{
  90,
  "n/a",
  70,
  "n/a"
}

Example 2 — Nothing below the line

Input: ri!scores
{
  90,
  70
}
Input: ri!minimum
60
Output:
{
  90,
  70
}

Example 3 — Everything below the line

Input: ri!scores
{
  10,
  20
}
Input: ri!minimum
60
Output:
{
  "n/a",
  "n/a"
}

Example 4 — Exactly on the line is kept

Input: ri!scores
{
  60,
  59
}
Input: ri!minimum
60
Output:
{
  60,
  "n/a"
}

Example 5 — No scores at all

Input: ri!scores
{}
Input: ri!minimum
60
Output:
{}

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