Report internationalisation

For 1.8 I would like the standard reports to be as internationalised as possible. Apart from the langage problem, there seem to be 3 things to address: page size (eg A4/US Letter switching); currency format; and date format.

Page Size: I cannot see a way to autoswitch from A4 to Letter.  However, since A4 is narrower than Letter, but longer, to manually change a report from A4 to use with Letter, all one needs to do is to decrease the page height from 842 down to 792.  The page width can be left at the A4 setting of 595 and not increased to the Letter setting of 612. This makes it very quick to clone a Letter format report from an A4 one.

Currency Format: iReports handles this automatically

Date Format: instead of using a hard coded date pattern like dd/mm/yyyy, one can use an expressions such as:

DateFormat.getDateInstance(DateFormat.SHORT,$P{REPORT_LOCALE}).format($F{startTime})

and (if you need date and time)

DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT,$P{REPORT_LOCALE}).format(new Date())

The only problem I have found with the above is that with the Australia locale, the short date format is d/mm/yy and thus one needs to right align dates to get them to line up.

The attached report includes the date and currency internationalisation.  I know it works in Australia, Hong Kong, and South Africa (where they use a yyyy/mm/dd short date format).

I would appreciate it if someone in the US/Canada could test it there.

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Report internationalisation

You can use the date:formatDate(date, style) function to achieve the same thing, where style is one of "short", "medium", or "long". There are also variants for times and date/times.

See http://www.openvpms.org/documentation/csh/1.8/reference/jxpath#date for details.

Re: Report internationalisation

Tim - date:format... is the way to go in documents using the OpenVPMS datasource, but this is not available when using the SQL datasource - ie when running a report from Reporting|Reports.

At least I am fairly confident that this is the case.  Please correct me if I am wrong.

Regards, Tim G

Re: Report internationalisation

You are correct. When SQL-based reports are run, Jasper Reports handles the creation of the JRDataSource internally, so there is no support for invoking jxpath functions.

Syndicate content