Four Js Development Tools Forum

Discussions by product => Reporting tools (GRW, GRE) => Topic started by: Huy H. on March 14, 2019, 08:15:13 pm



Title: Looking to set Title metadata in 4rp
Post by: Huy H. on March 14, 2019, 08:15:13 pm
We have a set of 4rp report templates that we use in our application that's bilingual (English and French).  We've gone an localized these reports, but the one place we have not been able to do that is the report Title.  When the report title is set for the document root, a PDF/SVG generated will have this metadata added to the document, allowing the previewer application (such as Adobe PDF or Browsers) to show the title of the report on the application chrome. 

The problem we have is that this is that the metadata is not localizable, so it does not look right when the application runs in a different language.  Referring to the documentation online, meta data manipulation can only be used for compatibility reports only (not .4rp): https://4js.com/online_documentation/fjs-gst-manual-html/#gst-topics/r_grw_API_functions_set_report_metadata.html#r_grw_API_functions_set_report_metadata

Is there anyway we can have the title localized without resorted to created multiple sets of .4rp files?


Title: Re: Looking to set Title metadata in 4rp
Post by: Reuben B. on March 14, 2019, 10:30:48 pm
A quick test suggests that CALL fgl_report_setTitle() can be used to override the value in the .4rp and appears in the Chrome of the Genero Report Viewer, and in the Document Properties of a PDF Report. 

Reading the documentation, it could possibly be worded better, but I don't think it says that these functions only apply to ASCII reports (where there is no .4rp and hence no other way to set these values), but instead it is trying to say that the best place to set these values is in the .4rp.

An issue I do see with using the fgl_report_setTitle(%"title") or fgl_report_setTitle(LSTR(title_variable)) is that the 4gl is responsible for the title and so would need to have it somewhere where it can find it, which could be an issue if you have wrapped up most of the fgl_report calls in a library.  I could see how being able to set the metadata in the .4rp as an RTL expression such as  "report.title.invoice".translate()  would be advantageous.

Reuben


Title: Re: Looking to set Title metadata in 4rp
Post by: Alex G. on March 15, 2019, 09:16:32 am
I can confirm that calling the metatdata functions like fgl_report_setTitle() works for any report type.
I have registered GRE-744 "Provide a way to localize metadata in the 4rp".
I am in favor of introducing a boolean "Localize Metadata" flag on the root. I toyed with the thought of allowing RTL expressions as they could also be handy to have a dynamic title that is populated from a variable. I vote against it because it can cause runtime errors on empty reports (it will complain that the variable is not available) .
If that is needed then it is possible to use the API functions.

Alex 


Title: Re: Looking to set Title metadata in 4rp
Post by: Huy H. on March 15, 2019, 10:06:38 am
Thank you gentlemen! We will give fgl_report_setTitle() a try.