Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Set variable values from Master Page and use across pages(Problem about setting variable values by scripts in Master Page, not in the report, and then accessing the set value in every page framework generated by the Master Page.)
Set variable values from Master Page and use across pages [message #1805349] Fri, 12 April 2019 07:51
Adrian HUANG is currently offline Adrian HUANGFriend
Messages: 1
Registered: April 2019
Junior Member
We have Master Page in the library for all reports to link with to print in a consistent framework.

We want to print different logos based on who runs the report, and the user/logo mapping information is stored in the database.
Now we are able to

• Obtain the user name from the HTTP request of the report launch
• In the Master Page's logo image element's OnCreate event, use a script to create a dataset and query the database and obtain the logo image URL, and then
• In the logo image's OnRender event, set the image URL to print the correct logo on the Master Page.

So basically we are able to implement the required functionality.

The problem:

If the report output ends up having many pages, with the current design, on every page when printing the logo a database query will be fired and this may impact performance.

I am thinking to use a variable to store the logo URL obtained from the database query that is fired at the first page logo print, and then all logo printings on subsequent pages will skip the query if this variable is already set.

What we haven't got success is to find such a variable that can carry a value across different page instances of the Master Page. We have tried setting value of (1) setGlobalPersistentVariable, (2) Page Variables (page type and report type), and (3) JavaScript variable of the logo image itself (this.xx), and none of them can be obtained value from another page.

We set up an experiment to script in the OnCreate event of a Label element in the Master Page to obtain the current value of a variable (of one of those aforementioned types), increase by 1, and then put back. And then script the Label's OnRender event to print the variable's current value. We expect each page to print increasing values, but in fact all pages just print the initial value. This appears to me like that each page instance generated from the Master Page is isolated and they don't share a comment context that can carry values across page instances.

I understand that setting values of a Page Typed Page Valuable from the report content and then consuming it in the Master Page can realize the functionality of print different values on each page, for example page number by group. However, setting value of a Page Variable (page type or report type) from Master Page doesn't seem to be able to carry the effect across pages.

How can we do that? We need this entire mechanism to be done in the Master Page itself and cannot depend on report specific data, because this is a generic Master Page in the report library, linked by all reports.

Or can someone refer a resource that explains the generation process of Master Page page instances in detail, and the relationship with the report contents?

Previous Topic:Parameter Validation check
Next Topic:Group only 1 Y Axis on Chart
Goto Forum:

Current Time: Fri Nov 22 10:28:42 GMT 2019

Powered by FUDForum. Page generated in 0.01648 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top