where(): find the positions of the passing scores
Easy
Return the positions of the scores that are 60 or above, counting from 1.
{60, 45, 72} gives {1, 3}, not {60, 72}.
Input
ri!scores— List of Integer
ri! Rule Inputs
ri!scoresList of Integer{
60,
45,
72
}Example 1 — First and third pass
Input: ri!scores
{
60,
45,
72
}Output:
{
1,
3
}Example 2 — All pass
Input: ri!scores
{
90,
80
}Output:
{
1,
2
}Example 3 — None pass
Input: ri!scores
{
45,
10
}Output:
{}Example 4 — Exactly 60 counts
Input: ri!scores
{
59,
60
}Output:
{2}Example 5 — No scores at all
Input: ri!scores
{}Output:
{}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