local!employees: { {id: 1, name: "Smith", dept: "Engineering", role: "Senior Engineer"}, {id: 2, name: "Josh", dept: "Finance", role: "Payroll Manager"}, {id: 3, name: "Henry", dept: "Engineering", role: "Quality Engineer"}, {id: 4, name: "Rone", dept: "Engineering", role: "UX Designer"}, {id: 5, name: "Denial", dept: "Sales", role: "Account Executive"}, {id: 6, name: "Harry", dept: "Sales", role: "Regional Director"}, {id: 7, name: "Peter", dept: "Human Resources", role: "Benefits Coordinator"}}
Hi,
I have this array, and I want to get the items whose "dept" is "Sales" using functions and without using foreach loop. Please explain how this could be done.
Discussion posts and replies are publicly visible
Try to combine index() + wherecontains() or index() + where() + like()
index( local!employees, wherecontains( "Sales", touniformstring(index(local!employees,"dept",null)) ), {} )
Is there something I can use to find multiple values? Such as...
index( local!employees, wherecontains({"Sales", "Finance"}, touniformstring(index(local!employees,"dept",null)) ), {})
Yeah, you can