Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316066 - Does BIRT provide the API for users to catch the report running result programmatically
Summary: Does BIRT provide the API for users to catch the report running result progra...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JingwenShen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-07 18:37 EDT by James Y. Zhu CLA
Modified: 2010-07-02 09:38 EDT (History)
4 users (show)

See Also:


Attachments
sample to customize page numbers with page variables starting from 2. (34.11 KB, application/octet-stream)
2010-06-12 04:07 EDT, JingwenShen CLA
no flags Details
test result (62.52 KB, application/x-zip)
2010-07-02 03:22 EDT, JingwenShen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Y. Zhu CLA 2010-06-07 18:37:31 EDT
Build Identifier: any

Does BIRT provide the API for users to catch the report running result programmatically?  for example, the users can catch the total number page number via report parameters or variables.

Another question on pagination: can the user customize the page numbers? for example, we can start from a specified page number, not always starting from 1.

Thanks,
James 

Reproducible: Always
Comment 1 Jun Ouyang CLA 2010-06-07 22:48:22 EDT
For page number, if what you need is just the page count, you can generate report document by RunTask and retrieve page count from ReportDocument.

If you want get page number/count at render time, you can define onPageStart/onPageEnd script to invoke your code.
For example, say there is a class test.Test.java, define such script in onInitialize:
    test = new Packages.test.Test();
define following script in onPageEnd:
    test.setPageNumber( pageNumber);

Currently, we can't define customized page number.
Comment 2 Jun Ouyang CLA 2010-06-08 01:11:52 EDT
To get page number, a better way is to define a IPageHandler to engine task.

I will try to find out a workaround to customize page number.
Comment 3 Jun Ouyang CLA 2010-06-11 22:28:52 EDT
Please provide a sample to customize page numbers with page variables.
Comment 4 JingwenShen CLA 2010-06-12 04:07:18 EDT
Created attachment 171777 [details]
sample to customize page numbers with page variables starting from 2.

the steps to use the page variable:
(1)New a page variable named "page_num";
(2)Add script on master page's onPageStart:
reportContext.setPageVariable("page_num",pageNumber+1);
(3)Drag page variable from AutoText to master page footer.
(4)View report in web viewer and export to any format that you want.

But page variable does not worked if you does not use web viewer,please see bug #276647:https://bugs.eclipse.org/bugs/show_bug.cgi?id=276647
Comment 5 JingwenShen CLA 2010-06-12 04:08:17 EDT
Set the resolution to worksforme.
Comment 6 James Y. Zhu CLA 2010-06-14 11:33:09 EDT
Thanks. It looks that it only works for the first page.
Comment 7 JingwenShen CLA 2010-07-02 03:22:20 EDT
Created attachment 173271 [details]
test result
Comment 8 JingwenShen CLA 2010-07-02 03:22:31 EDT
Hi,

The page variables works well in my test, please see the attachment.
You should use web viewer and export the report.

Thanks,
Jingwen