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
I think this would be a good use case for the filter() function. You create a separate helper function which implements the conditions and filter() will return only matching values from your list.
It could if his final goal is to have the list of object and he do not care about the the indexes.
But yeah that is a good option
Jose