Skip to main content
ashutoshg0001
October 14, 2021
Question

Compare a value in the list

  • October 14, 2021
  • 2 replies
  • 0 views

Hi ,

    I have a list of 5 text values returned by a rule like names as { "abc","def","ghi","jkl","mno" } ,  I want to compare a name as "def" in this list without using any loop. is there any function in Appian which can perform comparison without using any loop?

    2 replies

    marco.amador
    October 14, 2021

    Seems like contains() is what you're looking for - https://docs.appian.com/suite/help/21.3/fnc_set_contains.html

    contains({"abc", "def", "ghj", "jkl","mno"}, "def")

    mikes0011
    Brainy
    October 14, 2021

    And if the desired result is the positional indices in the array where the target value occurs, whereContains() will work for this case.  Note that I believe this function will not be any more effectively efficient than doing an a!forEach() loop, but at least it's (slightly) less code.

    The Expression Guru