Jump to content

determining jasper report total pages


z3n71n3l

Recommended Posts

Hey Devs


I would  like to determine the amount of pages which my jasper report result returns.


I successfully wrote a PHP xml service which access my jasper server’s services via a soap connection. I can view all my jasper reports on my website now. The 'BUT' is that some of reports take a long time to return a result. Thus I made used of the paging functionality build into the jasper XML services. So that the user only retrieves one page at a time. The problem that I have is that I cannot determine the total amount of pages that my report consists of and thus I cannot stop the user from paging outside the boundaries of the report.


For example if the report consists of 100 pages, the user can page beyond 100.


 


Code:
<request operationName="runReport">
<argument name='RUN_OUTPUT_FORMAT'>HTML</argument>
<argument name='PAGE'>10</argument>
<argument name="USE_DIME_ATTACHMENTS"><![CDATA[1]]></argument>
<resourceDescriptor name="" wsType="reportUnit" uriString="d(O_o)b" isNew="false">
<label></label>
<parameter name="d(O_o)b"><![CDATA[2009/9/28]]></parameter>
<parameter name="d(O_o)b"><![CDATA[2009/9/29]]></parameter>
</resourceDescriptor>
</request>
Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

As you know, you can get back a variety of output formats, including a Java object - a "JasperPrint" or JRPRINT in the web services call. This is the complete report and you can determine the number of pages from that. Of course, this will be some work to manage on the PHP end.

 

The other output formats  do not give a maximum number of pages.

 

Could you get the complete report, store it on your server end and manage the pagination there? That would be faster than requesting a page at a time, as the report wil have to be rerun for each page.

 

For large reports, it may be better to schedule a report and have JasperServer send it to the user via email, either as an attachment or as a link back to JasperServer. You can schedule reports via web services, running immediately "in the backgound" or at specific times.

 

 

 

Sherman

Jaspersoft

Link to comment
Share on other sites

Would it not be possible to have the number of pages returned in the xml response, when the report type is HTML and pagination is on.

 

This is something that just makes sense, or at least I think so. Why have pagination support if you dont know the total number of pages for the report.

 

I think this is very necessary. Can I log this as a feature request?

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...