Evaluating Expression inside a String

Hi all, I am having the following problem. In the detail band I get a very specific field from the database which requires further processing. So I call a Java method inside a textField to process this requirement.
content of the textfield: ReportUtils.testMethod($F{FIELD_FOR_PROCESSING})
Sadly, part of the returned String has to be a resource bundle reference. When I return "$R{id}" just to test the functionality, reference is not replaced.
printed output: $R{id}
wanted output: ID (taken from the resource bundle)


I have few ideas for a workaround but none of them is "nice". Do you have any suggestions on how to solve it, please?
Thank you in advance, Jan

honza.brtek's picture
Joined: Mar 31 2017 - 7:18am
Last seen: 2 years 7 months ago

3 Answers:

I'll hand over resourceBundle & report locale into the menthod to build a final String.

Please, let me know if you have a smoother solution.

Thank you!

honza.brtek's picture
Joined: Mar 31 2017 - 7:18am
Last seen: 2 years 7 months ago

I am working with a Java application to create PDF.
In my application,
I use i18n as ResourceBundle to get the text base on Locale.

And in my method, I return a string from i18n bundle resource I want.

java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("localization/i18n", Locale.JAPAN);
 
return bundle.getString("id");

Hope this can help you.

I am Leo's picture
1905
Joined: Jan 3 2020 - 3:13am
Last seen: 5 months 1 week ago

Thank you, will try!

honza.brtek's picture
Joined: Mar 31 2017 - 7:18am
Last seen: 2 years 7 months ago
Feedback