Jump to content

REPORT_COUNT Giving Old Value


darelrex

Recommended Posts

 I have a Jasper report in which each subreport takes up a whole number of pages (1 or more pages).  There is no way for me to know how many pages each subreport is going to take -- Jasper figures that out when it compiles the report.

In the header of every page, I need to display some information that is relevant to the subreport that is shown on that page.  The only way to do this, as far as I know, is to create a field in the header and populate it with a condition like this:

$V{REPORT_COUNT}.intValue() == 0 ? "aaa" : $V{REPORT_COUNT}.intValue() == 1 ? "bbb" : "ccc"

That should cause the header to show "aaa" for all pages of the first subreport, "bbb" for all pages of the second report, and "ccc" for all pages of the third (last) report.

My problem is that REPORT_COUNT is not delivering the correct value.  It seems to be giving the number of subreports that had been accessed before the current page started processing.  So I get something like this:

Page 1 (report A) --> REPORT_COUNT is 0

Page 2 (report A) --> REPORT_COUNT is 1   (problem)

Page 3 (report B) --> REPORT_COUNT is 1

Page 4 (report C) --> REPORT_COUNT is 2

Has anyone else encountered this problem?  Is there a known solution?  Thanks very much in advance.

Link to comment
Share on other sites

  • 3 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi There,

We found that this is the actual behaviour of the REPORT_COUNT variable. See the below definition of REPORT_COUNT.

REPORT_COUNT

After finishing the iteration through the data source, this report variable contains the total
number of records processed.

As per the above definition, the report_count will be calculated after the iteration through each row

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...