Forum Discussion

manfredt's avatar
manfredt
Occasional Contributor
3 years ago

How can i find a specific data constellation in an array

Hi,

i'm trying to verify a change of roles for a user in a report. The report is an array of [user,[roles]]. Which means every user is one entry in the array and next to the user information is an array of the roles of the user.

I know the username and the role that i added or removed. I can search the array for the username ($[*][?(@.name=='username')] which returns the complete user information without the roles. Similar i can search for the role and that returns the role information (several times) but without the user information.

 

Can i combine those two to find the one item that has the correct username and role? Or change the query so that it returns the roles as well? Or is there a way to identify the position of that user in the list and then query that specific entry in the array?

 

Thanks in advance