Use Built-In Parameters in Jaspersoft Reports

Posted on by By Nikhilesh, in Business Intelligence, Jaspersoft, Open Source Business Intelligence | 1

Use BuiltIn parameters in Jasper Reports

Jasper provides few builtIn parameters which can be used in JRXML.

Make data easy with Helical Insight.
Helical Insight is the world’s best open source business intelligence tool.

Grab The 30 Days Free Trail

Click on this link for more information
Following are few built-in parameters

    1. LoggedInUserFullName :
      • Type of this parameter is ‘String’.
      • This parameter gives you full name of loggedin user.
    2. LoggedInUsername :
      • Type of this parameter is ‘String’.
      • This parameter gives you user name of loggedin user.
      • Example: If you want to show username and fullname of person at the bottum of your page then you can use this on your page footer
"Last printed by " + $P{LoggedInUserFullName} + " on "  + new java.util.Date() 
    1. LoggedInUserTenantId :
      • Type of this parameter is ‘String’. Not applicable for Community Edition.
      • This is used to get organization of logged in user.
    2. LoggedInUserRoles :
      • Type of this parameter is ‘Collection<String>’.
      • This parameter gives you all roles of loggedin user.
      • Example : if you want to show only reports to user who has role ‘ROLE_ADMINISTRATOR’ then you can use this in print when expression
($P{LoggedInUserRoles}.toString().contains("ROLE_ADMINISTRATOR")) ? new Boolean(true) : new Boolean(false)
  1. LoggedInUserAttribute_<attribute name> :
    • Type of this parameter is ‘String’.
    • This built in parameter is used to get value of specific profile attribute by passing the name of profile attribute name.
    • Eample: lets say one of your profile attribute name is city and profile attribute value is Maxico.
      If you want to get value of city (value Maxico) in your JRXML then do this
      -> replace “_<attribute name>” to profile attribute name
      ie. LoggedInUserAttribute_city

As we know, we can add comma separated value to profile attribute but we can not directly use this profile attribute in JRXML as list. In order to use comma separated profile attribute as a list in your JRXML then refer this

Convert Comma Separated Profile Attribute to list in Jasper Reports

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

0 0 votes
Article Rating
Subscribe
Notify of
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
I need to show the all roles in current user in jasper server ?