Returns the value of the 'custom data' property set when using APIs to build login credentials .
- Returned Output: Text
- Library: PQL \ Common \ Identity
- Version: 2018.00.000
- 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.
- The function returns a text string of the custom data property
- The function takes no inputs
- The function is often used to customize the way queries or formula's operate based on the user that is currently running a report or dashboard. It can also be 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 customdata function.
- The other "identity" functions can be used to secure and customize the analytics experience. For more see the UserName function.
Setting Custom Data
Custom data is a way for developers to programmatically pass into Pyramid differentiating details for a given user during the login and authentication process. Since its a free form string, it can contain more than one element of data. Using string parsing in Pyramid, the different elements can be sharded and used in different ways as needed.
Custom data is set once per login - so the value remains static for the life of the user's session. Generally, it is used when other details about the user (like user names, UPN, email etc) cannot be effectively used to differentiate user security.
This example shows how to use the UserCustomData function to create a member object from a table called "customer", on a column called "country".
If the logged in user had been logged in via API, and had their custom data property had been set to "USA" , it would return a member with unique name [Customer].[Country].[USA]. If this was used in the member security settings for a model in the admin settings, it could be used to filter all the rows in the customer table to USA data, which in turn would secure the data for the entire model.
In this more complicated example, the UserCustomData can be used to drive different logical formulas with string manipulation. If the custom data had been set to AU2019, the first part of the data can be used to drive one formula (like picking country)
if( left(UserCustomData(),2)=="AU", ([Customer].[Country].[Australia]), ([Customer].[Country].[Canada]) )
while the second part can be used to pick a year - 2019
The above formula looks at the last 4 characters of the custom data using the Right function to determine the year to use in the formula.