Conditionally execute filter

Hello,
I have this filter: myfield eq '${security.user.roles[0]}'

But if '${security.user.roles[0]}' eq 'admin' the filter must be skipped because admin can view all records.

I have tried to add in filter '${security.user.roles[0]}'='admin'
But I get a bad request, how can I do it?
Thanks,
Mario

Hi Mario,

Maybe you can have two separate invokes with condition if the user is admin or not. The invoke for admins will not have $filter parameter.

Best Regards,
Vladimir

I need to wake again this thread.
I have exactly that filter: ${event.filter} AND myRole eq '${security.user.roles[0]}'
I need to skip the AND part if the user role is "admin".
I have already three queries if I have to add separate invokes I need to do six queries it begins to be complex.

If I can do ${event.filter} AND '${security.user.roles[0]}' in myRole
I can remove the admin role and say that an user to be admin has to have all roles.
But the query above does not work. I do not see errors in the query but I get no results.
BTW: how can I log all queries sent to DB including parameters? In the past I used tshark but now it does not work anymore. In the documentation I do not find the right way to do it.

Hi
I would to keep it simple in the LoadData of the grid create two 'Invoke data source method' and in the Condition have one ${security.user.isInRole("admin")} and the other ${!security.user.isInRole("admin")}