Skip to main content
1/5

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 Text
  • ri!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"
Expected output:
{2}

Example 2: Found twice

Input: ri!items
{
  "a",
  "b",
  "b"
}
Input: ri!value
"b"
Expected output:
{
  2,
  3
}

Example 3: Not there at all

Input: ri!items
{
  "a",
  "c"
}
Input: ri!value
"b"
Expected output:
{}

Example 4: The wrong case does not match

Input: ri!items
{
  "a",
  "b"
}
Input: ri!value
"B"
Expected output:
{}

Example 5: An empty list

Input: ri!items
{}
Input: ri!value
"b"
Expected 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