Looking for Function which is similar to Search and find with multiple search text

Hi All,

I am Looking for the function or query to check the array value with multiple values similar to search/find function with one search text. 

Validation that I am working on is like I have to check the values "A" and "B" in the string {"A", "C", "C", "B", "A", "C"} and the results should be {1 0 0 1 1 0}. 


Is it possible to have the function or should we have to create any query rules?

Thanks......!

Vaithyanathan R

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    If you're trying to search text you already have on-hand, I suggest you check out the Regular Expression Functions plug-in since RegEx matching is more powerful than almost anything else.  If you're looking instead to do mutliple value searching within an a!queryEntity call, you can't easily do matching as powerful as RegEx, but with multiple and nested a!queryLogicalExpression() calls you can do quite a bit.  Can you clarify a bit as to your exact use case?

  • Hi Mike,

    Thanks for your comments.

    Use case is like I am trying to check 2 user name with list of users where both user name and list of users were dynamic.I have 2 local variables to store the Expected user and remaining users in 2 local variables (if any). 

    Earlier we had only one user "A" so we used the below,

    wherecontains(0, search("A", {"F","B","C","A"})) which will provide the confirmation that the user we are looking for is in 4th position.

    And we are storing the 4th position value in first local variable & whatever the array values that is remaining apart from 4th posision will be stored in the second local variable

    Now I have to check for user A and B.

    So I wanted to check if A and B available in the array. If available whatever the value we have should be stored in first variable and remaining values in the array should be stored in second local variable

    Note: I may have only A and B, A and B along with few other, Any one of A or B alone, Any one of A or B along with others, Only others and no A or B, etc

  • Not sure I fully understand what you are asking for here, but maybe one of these helps:

    a!localVariables(
      local!fullListOfUsers: {"Fred", "George", "Bob", "Cal", "Abe"},
      local!desiredUsers: {"Abe", "Bob"},
      {
        remainingUsers: difference(local!fullListOfUsers, local!desiredUsers),
        indecesOfDesiredUsersBoolean: a!forEach(
          items: local!fullListOfUsers,
          expression: contains(local!desiredUsers, fv!item)
        ),
        indecesOfDesiredUsersInteger: tointeger(
          a!forEach(
            items: local!fullListOfUsers,
            expression: contains(local!desiredUsers, fv!item)
          )
        )
      }
    )

    Results in: