Question
In Appian, how would you generate a list of numbers from 1 to 500, and then display only every 100th number (i.e., 100, 200, 300, 400, 500) from that list using Appian expressions?
A
Anonymous
November 8, 2025
50
Answer
This expression is written using Appian SAIL syntax with a!localVariables, a!forEach, and reject() functions.
Let’s break it down step by step:
Define local variables
local!data: enumerate(500) + 1
- enumerate(500) generates a list of numbers starting from 0 to 499.
- Adding + 1 shifts the entire list by one, so now local!data becomes:
{1, 2, 3, ..., 500}
Iterate through the list using a!forEach
a!forEach(
items: local!data,
expression: if(mod(fv!item, 100) = 0, fv!item, "")
)
- a!forEach loops over each number in the list.
- For each item (fv!item):
- It checks if the number is divisible by 100 using mod(fv!item, 100) = 0.
- If true, it returns that number.
- If false, it returns an empty string ("").
So the intermediate result looks like:
{"", "", ..., 100, "", "", ..., 200, "", ..., 300, "", ..., 400, "", ..., 500}
Remove null/empty values using reject()
reject(fn!isnull, ...)
- reject() filters out unwanted items from the list.
- fn!isnull checks for null or empty values.
- So only the non-null values (i.e., 100, 200, 300, 400, 500) remain.
Final Code
a!localVariables(
local!data: enumerate(500) + 1,
reject(
fn!isnull,
a!forEach(
items: local!data,
expression: if(mod(fv!item, 100) = 0, fv!item, "")
)
)
)
Final Output
{100, 200, 300, 400, 500}
JuniorExpressions#coding#sailcoding
Loading comments...