OverviewThe following was extracted from Cascading Input Controls . As of version 3.7, the following parameters are available for query input controls. "Standard" controls will always be provided to reports (for example, for use in expressions), even if an input control is not defined for them. | [toc] |
Parameter Name | Type | Notes | Standard? |
---|---|---|---|
LoggedInUser | User | Not usable in query input control, but is used as parameter to report | Yes |
LoggedInUsername | String | Of logged in user | Yes |
LoggedInUserFullName | String | Of logged in user | No |
LoggedInUserEmailAddress | String | Of logged in user | No |
LoggedInUserEnabled | Boolean | Is logged in user enabled? | No |
LoggedInUserExternallyDefined | Boolean | Is logged in user externally defined? ie. authenticated externally | No |
LoggedInUserTenantId | String | Of logged in user. Only relevant in Pro/Enterprise. | No |
LoggedInUserRoles | Collection<string> | Current set of roles of logged in user. Useful for $X parameter | No |
LoggedInUserAttributes | Map<string, string> | Not usable in query input control, but is used as parameter to report. Empty map if no attributes | No |
LoggedInUserAttributeNames | Collection<string> | User profile attribute names. Useful for $X parameters. Empty collection if no attributes | No |
LoggedInUserAttributeValues | Collection | - | No |
LoggedInUserAttribute_<attribute-name> | String | For the logged-in user, the value of the attribute matching the name passed as <attribute-name> (such as att1). If there's no attribute with this name for this user, the parameter is empty. This parameter is available only if it's defined in a query or as a report parameter. | No |
LoggedInTenantAttribute_ | String | Same as above, but only checks for Organization-level attributes. |
|
ServerAttribute_<attribute-name> | String | Same as above, but only checks for Server-level attributes. | No |
Attribute_<attribute-name> | String | Recommended. Same as above, however this will check each level of attributes, in order, until one is matched:
| No |
For a full list, refer to: https://community.jaspersoft.com/documentation/tibco-jasperreports-server-administrator-guide/v790/query-based-input-controls#Built-in_Parameters
Changes to parameters for reports in JasperReports Server
The above built-in parameters are also provided for reports if they are defined as parameters in the JRXML. This adds to the LoggedInUser and LoggedInUsername parameters that are available in earlier versions.
When you create a parameter in the Report, its Type must match the Type from the above list.
Examples
Print When Expression example (also attached to this article as LoggedInUserRoles.jrxml):
($P{LoggedInUserRoles}.contains("ROLE_ADMINISTRATOR")) ? new Boolean(true) : new Boolean(false)
Page footer example:
"Last printed by " + $P{LoggedInUserFullName} + " on " + new java.util.Date() + "\n LoggedInUserRoles include: " + $P{LoggedInUserRoles}.toString()
This is an example of Logged In User Attributes in an iReport, domain-based report:
- JasperReports Server Ultimate Guide - Security definition
- JasperReports Server Ultimate Guide - JRXML
See Also
- How to use built in parameter (LoggedInUser) in report and scriptlet
- Using report parameters
- Creating additional built-in parameters
- Designing_Row-Based_Security_into_Standard_Reports - Using Attributes and Rows
- Designing_Column-Based_Security_into_Standard_Reports - Using Roles and Columns
- Accessing_the_Logged_In_User_within_a_Query-based_Input_Control - Query Based input controls with LoggedInUser
- Built-in Parameters for Query-based Input Controls of JasperReports Server Administrator Guide
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now