wherecontains for multiple conditions

How can I use wherecontains() for multiple conditions? 

For example, let's say I have an array of my cdt type Person, called people:

[
    name="Ben", 
    age=20
]; 
[
    name: "Sam", 
    age:50
]

I could write wherecontains("Ben", people.name). This would return the first element in the array.

But what if the array looked like this:

[
    name="Ben", 
    age=20
]; 
[
    name: "Ben", 
    age:50
]

I still want to get the first index but wherecontains("Ben", people.name) would return both indices. How can I add a condition to check name AND age? 

  Discussion posts and replies are publicly visible

Parents
  • Hello Fabian ,

    Let me think of this but one way to get this is to run a for each and in the expression  you check for the name and age and return the fv!index. If not return {} or null or -1 .

    If you still insist with the where contains, well you can make two arrays for each evaluation, and then make a difference, or intersection so that gives you the indexes which match both conditions

    Hope this helps

    Jose

Reply
  • Hello Fabian ,

    Let me think of this but one way to get this is to run a for each and in the expression  you check for the name and age and return the fv!index. If not return {} or null or -1 .

    If you still insist with the where contains, well you can make two arrays for each evaluation, and then make a difference, or intersection so that gives you the indexes which match both conditions

    Hope this helps

    Jose

Children
No Data