Jasper Reporting

Does JMix pass the locale to the Jasper Reporting ?

For me, this does not seem to be the case, as my numbers are wrong formatted ;/

new DecimalFormat("#,##0.00").format($F{Soll})

Seems to miss the Locale Param …

params.put(JRParameter.REPORT_LOCALE, Locale.ITALY); 
JasperFillManager.fillReportToFile(jasperReport, params);

Hi @asshleyymariei

Thank you for your comment :smiling_face_with_three_hearts:

I know, that this is possible. My question was, if JMix does so !

My call to the report is

		Report report = getReportByCode("AC2");
		if ( report != null ) {
			Set<Account> accounts = accountsDataGrid.getSelectedItems();

			uiReportRunner.byReportEntity(report)
					.withOutputType(ReportOutputType.PDF)
					.withParametersDialogShowMode(ParametersDialogShowMode.YES)
					.addParam("Accounts", accounts )  //  Parameter alias
					.runAndShow();
		}

I don’t see any access to the JasperFillManager

After reading, my comment, I found a workaround :open_mouth:

			uiReportRunner.byReportEntity(report)
					.withOutputType(ReportOutputType.PDF)
					.withParametersDialogShowMode(ParametersDialogShowMode.YES)
					.addParam("Accounts", accounts ) //  Parameter alias

                    .addParam(JRParameter.REPORT_LOCALE, getLocale())

					.runAndShow();

But I think, JMix should set this locale by default already :smirk:

Regards

Felix

Hello @f.zehnder,

It’s right. The Reports add-on does not set the locale in Jasper reports. You can create a formatter for your field or use your own workaround.

Regards,
Nikita

Hello @shchienko

I think you should add this to the documentation, that with

                    .addParam(JRParameter.REPORT_LOCALE, getLocale())

the programmer has to set to locale.

Regards

Felix