How to replace the hardcoded value of the user language preference in sql statement. (Jaspersoft Studio Report)
Release : 15.5, 15.6, 15.7
Component : CA CLARITY PPM Jaspersoft Studio
To create a report using user attribute, you will need to: 1) create the build-in system parameter LoggedInUser in report template JRXML file: <parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/> 2) create user attribute parameter LoggedInUserAttribute_<attribute-name> in report template JRXML file. <parameter name="LoggedInUserAttribute_userLocale" class="java.lang.String" isForPrompting="false"/> 3) use LoggedInUserAttribute_<attribute-name> in report query to select records.
select ....... where l = $P{LoggedInUserAttribute_userLocale} 4) compile report template in Jaspersoft Studio (JSS) before publishing it to JasperReports Server (JRS) 5) in JRS, create user attribute under Manage - Users web UI set values for each user to influence the report query result. superuser has userLocale = 'EN' demo has userLocale = 'FR'