An attribute is a name-value pair associated with a user account. Attributes can also be defined on organizations or at the server level and apply to all users in the organization or server, respectively. To define or modify the attributes for a user, organization, or server, see the section on defining attributes in the JasperReports Server Administrator Guide.
Use the following syntax to access attribute values for the logged-in user.
groovy('authentication.principal.attributes.find{ it.attrName == "locale" }.attrValue'))
An attribute value is always a string. You can use the following functions to cast it to other types, for example if you want to compare it to a field value.
Function | Syntax | Example |
Integer | Integer('string') | Integer('345') = 345; |
Decimal | Decimal('string') | Decimal('24.5') = 24.5; |
Boolean | Boolean('string') | Boolean('true') = true; |
Date | Date('string') | Date('2008-02-08') = d'2008-02-08'; |
Timestamp | Timestamp('string') | Timestamp('2008-02-08 11:30:00') = ts'2008-02-08 11:30:00'; |
Time | Time('string') | Time('11:30:00') = t'11:30:00'; |
For more information about using attributes in security files, see the JasperReports Server Security Guide and Jaspersoft OLAP Ultimate Guide.
Recommended Comments
There are no comments to display.