1/5

reject(): drop the nulls from a list

Easy

Return the list with every null removed, keeping the rest in order.

The test goes in the first argument, and it has to be a function reference — the name with fn! in front of it, not a call.

Input

  • ri!values — List of Integer, possibly containing nulls

ri! Rule Inputs

ri!valuesList of Integer
{
  1,
  null,
  3
}

Example 1 — One null in the middle

Input: ri!values
{
  1,
  null,
  3
}
Output:
{
  1,
  3
}

Example 2 — Nothing but nulls

Input: ri!values
{
  null,
  null
}
Output:
{}

Example 3 — No nulls at all

Input: ri!values
{
  4,
  5,
  6
}
Output:
{
  4,
  5,
  6
}

Example 4 — Nulls at both ends

Input: ri!values
{
  null,
  7,
  null
}
Output:
{7}

Example 5 — Empty list

Input: ri!values
{}
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