Issue Description
User wants to have different currency symbol for each Organization. User can format text fields in .jrxml report with different patterns. However, these patterns does not allow to use different currency symbols
Resolution
There is a way to maintain different currency symbol using Org attributes to create a pattern for currency text field.
First step would be creating two Org attributes 'language' and 'region'. Go to Manage > Organizations, choose your organization > edit, add two attributes with values 'sv' and 'SE' accordingly (These values represent Sweden Locale).
A report, i created for test has one text field and static text field:
Second step is a creation of parameters for pattern. For our pattern we would need three paramters (Type String):
- LoggedInTenantAttribute_language
- LoggedInTenantAttribute_region
- CurrencyPattern
Parameters 'LoggedInTenantAttribute_language' and 'LoggedInTenantAttribute_region' are built-in attributes parameters in TIBCO JasperReports® Server so we do not need expression for them. For parameter CurrencyPattern insert the following expression:
((DecimalFormat)(NumberFormat.getCurrencyInstance(new Locale($P{LoggedInTenantAttribute_language}, $P{LoggedInTenantAttribute_region})))).toPattern().replace("u00a4", DecimalFormatSymbols.getInstance(new Locale($P{LoggedInTenantAttribute_language}, $P{LoggedInTenantAttribute_region})).getCurrencySymbol())
Then add a pattern for your text field. Go to text field properties > Text Field tab > Pattern Expression and choose parameter CurrencyPattern.
Lets test this report. Publish report from TIBCO Jaspersoft® Studio to JasperReports Server, login with user which belongs to your organization and run the report. As a result you get a text field with formatted currency sign (Sweden kr in our case)
References
akovach case ref. 01583717
Recommended Comments
There are no comments to display.