UserTenant (PQL)

Returns the name of the Pyramid tenant that houses 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

UserTenant()

Comments
  • The function returns a text string of the user's tenancy.
  • 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
  • The other "identity" functions can be used to secure and customize the analytics experience. For more see the UserName function.

Examples

This example shows how to use the UserTenant function to create a member object from a table called "security", on a column called "tenant".

StrToMember([Security].[tenant],UserTenant())

If the logged in user was called "jsmith" and belonged to a Pyramid tenant called "Customer A", it would return a member with unique name [Security].[tenant].[Customer A]. 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 Security table of model, which in turn would secure the data for the entire model. So if the security table showed that Customer A users matched up with 'Customer-A-Data', then this function would limit the entire data model to only show Customer-A-Data for user jsmith.