wherecontains(): find every position of a value
Easy
Return the positions where ri!value appears in the list, counting from 1.
Every occurrence counts, and a value that is not there gives an empty list.
The value goes first and the list second.
Inputs
ri!items— List of Textri!value— Text
ri! Rule Inputs
ri!itemsList of Text{
"a",
"b",
"c"
}ri!valueText"b"
Example 1 — Found once
Input: ri!items
{
"a",
"b",
"c"
}Input: ri!value
"b"
Output:
{2}Example 2 — Found twice
Input: ri!items
{
"a",
"b",
"b"
}Input: ri!value
"b"
Output:
{
2,
3
}Example 3 — Not there at all
Input: ri!items
{
"a",
"c"
}Input: ri!value
"b"
Output:
{}Example 4 — The wrong case does not match
Input: ri!items
{
"a",
"b"
}Input: ri!value
"B"
Output:
{}Example 5 — An empty list
Input: ri!items
{}Input: ri!value
"b"
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