Home
Analytics
Reference BIRT Table Data Binding From Another BIRT Table
jjfeigal
I have a situation in a report that I am creating that I am having trouble implementing. Hopefully, I can clearly describe what I am trying to do.
Let's say I have a simple report with two BIRT tables. Both BIRT tables are bound to the same XML dataset, but each BIRT table has a separate unique data filter being applied to the XML dataset.
The footer in the first table contains a total count of the data records/entries selected by the first set of filtered data.
In the second table I am grouping the data based on the value of a particular XML data element in the second set of filtered data, and I am displaying in the group header the count for the XML data element value in the group header. In the group header of the second table, I would like to implement an aggregation/calculation where the count in the header is divided by the total count from the first table, but I can't figure out how to reference the total count from the first table.
I have also tried to embed the first table in a footer cell of the second table, but I still can't figure out how to reference the total count from the first table in the second table's group header in order to do the calculation.
Am I trying to accomplish the impossible? There doesn't seem to be a way to access data bindings in one BIRT table from another BIRT table.
Find more posts tagged with
Comments
mwilliams
Hi jjfeigal,
You can store the value from the first table into a PersistentGlobalVariable and call that variable in your second table so that you can do your calculation with the value.
Hope this helps.
jjfeigal
Thanks so much for the brilliant suggestion. BIRT is so robust that I don't always know how to search for a solution to a problem.
Using the book "Integrating and Extending BIRT" and your suggestion, I read how to set and get the value of a persistent global variable.
In the onCreate event of the data object used to generate the total count in the first table, I added the following script:
// Set a persistent global variable for the
// Total Count of customers that completed
// any education or training services
reportContext.setPersistentGlobalVariable( "totalCountCompletedEducationTrainingServices", this.value )
In the expression for the data binding used to generate the percent value in the second table, I added the following script:
// Generate the percent value using the value of the
// persistent global variable for Total Count of customers
// that completed any education of training services.
row["Data Item Count"] / reportContext.getPersistentGlobalVariable( "totalCountCompletedEducationTrainingServices" )
Awesome!!
mwilliams
No problem! Always glad to help! Let us know whenever you have questions!