Skip to main content

User-Specific Functions

  • 2 minutes to read

The Report and Dashboard Server provides the following functions that enable you to access information about the current user:

UserName()
Returns the current user’s name.
UserEmail()
Returns the current user’s email.
IsMemberOf(userGroupName)
Returns true if the current user belongs to a group specified by the userGroupName parameter.

You can use the UserName and IsMemberOf functions to make a data model return specific data subsets to different users. This restricts access to sensitive information in your database. Users cannot access and modify these functions unless they have permission.

Users can construct filters with these functions at the document level (to further filter the data available to them).

Data Model Level

You can create a filter with a user-specific function to define the users to which the query data is available.

The following filter string displays only orders shipped to a country to which the user group belongs (that is, a user from the USA group should not see orders shipped to other countries):

user-specific-functions-data-model-query-filter-string

For this function to take an effect, the Report and Dashboard Server should contain user groups for each country listed in the [ShipCountry] data column.

Document Level

Report and Dashboard Server users can apply these functions at the document level.

Do the following to apply a user-specific function to a report‘s query:

  1. Select a query in the Field List and click its Edit Query button.

    report-designer-data-source-query-edit

  2. On the invoked wizard page, create a new filter condition and select Function as a value source.

    report-designer-data-source-query-filter-string

  3. Click the value placeholder and select a user-specific function.

    report-designer-data-source-query-filter-string-user-name

Do the following to apply a user-specific function to a dashboard‘s query:

  1. Open the Data Sources screen, select a query and click its Edit Query button.

    dashboard-data-sources-edit-query

  2. Add a new filter condition and select Function as a value source.

    dashboard-data-sources-filter-function

  3. Click the value placeholder and select a user-specific function.

    dashboard-data-sources-filter-function-user-name