a!localVariables(): summarise a list as sum over count
Easy
Return the total and the number of items as one piece of text: {1, 2, 3} becomes "6/3".
Name both values as locals, then build the text in the final expression.
An empty list has a total of 0 and a count of 0.
Input
ri!numbers— List of Integer
ri! Rule Inputs
ri!numbersList of Integer{
1,
2,
3
}Example 1 — Three numbers
Input: ri!numbers
{
1,
2,
3
}Output:
"6/3"
Example 2 — A single number
Input: ri!numbers
{7}Output:
"7/1"
Example 3 — Empty list
Input: ri!numbers
{}Output:
"0/0"
Example 4 — Negative numbers still total
Input: ri!numbers
{
5,
-5,
10
}Output:
"10/3"
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