Hi, I have set of Roles in my UserProfile Application. I have spilt the role and stored in a Client Variable as GroupName. For example, if role is TRS_Admin or ER_Manager their GroupName would be GroupName = TRS or GroupName = ER. So I need to filter all the users who has the Roles that starts with the Client.GroupName .
If I give "like" operation it fetches all the users with roles that contains "ER", even if it doesn't start with ER, it shows from all the Application users that has role containing ER.How can I specifically fetch the User that that starts with the Client.Group? and Also is it possible to only the roles in my UserProfile Application ?
Hi Annie,
You can use below filter as also suggested by Wasim:Role.Name like Client.GroupName + "%"
You can also check how Like operator works using below linkhttps://www.w3schools.com/sql/sql_like.asp
RegardsKrishnanand Pathak
You can use :
Substr(Client.GroupName, 0,3) ,
Regards,
Amreen
Hi,
You can apply the filter like Role.Name like Client.GroupName+"%"
this will fetch you the group starts with Client.Group
Wasimkhan S
The answers suggested by Krishnanand and Wasimkhan are perfect if you want to continue using Client variable and 'like' operator in your filter.
But to answer your second question: "is it possible to only the roles in my UserProfile Application?" - you can do this.
In your aggregate you can use the function for Checking Roles to return a new attribute value giving a boolean whether each user has that specified role.This can then be used in your filter criteria.
(example above I just created the Roles, I do not have any users assigned :D )
Hi Mike,
That's a bad and nonsensical answer. You cannot use any OutSystems Function (with a few exceptions) in an Aggregate if it's result isn't static, that is, a Function that's used in an Aggregate cannot have an input that's an Entity Attribute. The reason for that is clear: an Aggregate is executed in the database, and the database cannot execute the Function.
In your example, what happens is that all rows of the query return the same value for CheckMyRoleRole(), as the function is evaluated before the Aggregate runs (using the currently logged in user as input).
Thank you for the pointers Kilian.Happy to learn.