Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316066

Summary: Does BIRT provide the API for users to catch the report running result programmatically
Product: z_Archived Reporter: James Y. Zhu <Yong.Zhu>
Component: BIRTAssignee: JingwenShen <jingwen.shen>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: hustlg, jingwen.shen, jouyang, wyan
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
sample to customize page numbers with page variables starting from 2.
none
test result none

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