UserRoles (PQL)
Returns the a delimited string of role names for the currently logged in user.
- Returned Output: Text
- Library: PQL \ Common \ Identity
- Version: 2018.00.000
- Compatibility:
- Can be combined with and other PQL function throughout the application.
- It CANNOT be used with MDX or VBA functions. But it can be used on MDX-based content in other parts of the application.
Syntax
UserRoles(OPTIONAL <Delimiter> )
* Click on the function's arguments above for more details on the input values.
Comments
- The function returns a text string of the user's roles
- The list is delimited by the optional provided delimiter string. Commas are used if no delimiter is supplied.
- The function is often used in driving member level security for data models - allowing a data model to be customized for each user logging into the application.
Different Function types
- This function is like the MDX username function.
- The other "identity" functions can be used to secure and customize the analytics experience. For more see the UserName function.
- Also see the UserRolesSet function,
Examples
This example shows how to build a set of role members using the roles of a user to drive the selections from a table called "security", on a column called "roles" using the StrToSet function.
StrToSet( [security].[roles], UserRoles(";"), ";" )
So if a user domain\jsmith logged in and belongs to Role A and Role B, the above function will return a set of member elements on the security table with roles A and B, which would appear as { [security].[roles].[role A], [security].[roles].[role B] }