BIRT Page Variable "lags behind"

I've set up a table with a group header, and set up a page variable to pass to the master page footer so that I can root aggregated values to the bottom of the
page. My problem is this lags behind by a group record. So for the first record it doesn't update the value in the master page footer, and then for the next record it updates it but for the previous records values.

My script is set up as so:

In the group header row's onCreate function I have:

reportContext.setPersistentGlobalVariable("currentSummedPriceEach",row["Aggregation"].toString());

and in the reports onPageStart i have:

vars["summedPriceEach"] = reportContext.getPersistentGlobalVariable("currentSummedPriceEach");

The display in the footer is just an AutoText variable getting the page variable I set up called "summedPriceEach".

This is all done using the classicmodels data source for an example.

Anyone got any idea how I can alter what I'm doing so that it updates it on the current page including the first page?

Using Birt Version 2.6.1 (can't update this unfortunately)

Comments

  • Could you please post the ClassicModels example?

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Thanks for the example. I don't have version 2.6.1. Possibly for that reason, I wasn't able to run the report. However, after looking at your code, I think I know what you are trying to do. I also think I know why it doesn't work. I believe the issue is the order of events. The Master Page gets created before the table which is why the Master Page footer is being populated first.

    I attached a report that shows a different approach. It was created in 4.5, the earliest OS Designer that I have installed. If the report doesn't run in your Designer, try copying the code into your report. Everything else should be the same.

    The code moves the group total to the bottom of the page. It does this by calculating the number of rows on the page and using that number to determine how far down to move the aggregation. Start by initializing a global variable in the beforeFactory of the report to hold the total row count. Then add code in the group footer row onCreate event to calculate the rows on the current page and update the total. In onCreate of the aggregation, calculate the distance to move the aggregation down the page so that it displays at the bottom of the page.

    I hope this works for you.

    Jeff F.
    Customer Support Engineer I
    OpenText
Sign In or Register to comment.