Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » BIRT report without WebViewer(How to get Paging on the HTML page when we show report on the page.)
BIRT report without WebViewer [message #669683] Wed, 11 May 2011 07:25 Go to next message
shine_1611 is currently offline shine_1611
Messages: 20
Registered: April 2011
Location: Mumbai
Junior Member
Hi,

I am using Ruby and Birt, and here I use BIRT apis to get the rptdesign and then I show the report result as html content on the Page.
Problem is I have thousands of records in that report and there is no paging coming in and which cause a lot of delay or Timeout issue. What is the way to add paging through APIs?

I checked the apis and saw Irender has paging but not sure how I can utilize that.

This is my code,

factory = org.eclipse.birt.core.framework.Platform.createFactoryObject (IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY)
engine = factory.createReportEngine(ENGINE_CONFIG)
design = engine.openReportDesign(report_name)

designHandle = design.getDesignHandle()
designFactory = designHandle.getElementFactory()

dsrc = designFactory.newOdaDataSource("DataSource", "org.eclipse.birt.report.data.oda.jdbc")
dsrc.setProperty("odaDriverClass", BIRT_CONFIG['oda_driver_class'])
dsrc.setProperty("odaURL", BIRT_CONFIG['oda_url'])
dsrc.setProperty("odaUser", BIRT_CONFIG['oda_user'] )
dsrc.setProperty("odaPassword", BIRT_CONFIG['oda_password'])

designHandle.getDesignHandle().getModuleHandle().getDataSour ces().add(dsrc)

@task = engine.createRunAndRenderTask(design);
#Set parent class loader for engine
@task.getAppContext().put(EngineConstants::APPCONTEXT_CLASSL OADER_KEY, CURRENT_THREAD.getContextClassLoader())


Thanks
Shivani
Re: BIRT report without WebViewer [message #669802 is a reply to message #669683] Wed, 11 May 2011 15:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

If you use a run task it creates a rptdocument file. You then can
specify what pages to render in a render task.

IReportDocument document = null;
//Open the report design
document = engine.openReportDocument("output/resample/mcb.rptdocument");
IReportRunnable irr = document.getReportRunnable();
IReportRunnable irrp = document.getPreparedRunnable();



String tst = document.getVersion();
System.out.println(tst);
IRenderOption options = new RenderOption();
options.setOutputFormat("html");
long pgcnt = document.getPageCount();
System.out.println(pgcnt);
//options.setOutputStream(arg0)
options.setOutputFileName("output/resample/mcb.html");


if( options.getOutputFormat().equalsIgnoreCase("html")){
HTMLRenderOption htmlOptions = new HTMLRenderOption( options);
htmlOptions.setImageDirectory("output/image");
htmlOptions.setHtmlPagination(false);
//set this if you want your image source url to be altered
htmlOptions.setBaseImageURL("http://myhos/prependme?image=");
htmlOptions.setHtmlRtLFlag(false);
htmlOptions.setEmbeddable(false);
}else if( options.getOutputFormat().equalsIgnoreCase("pdf") ){

PDFRenderOption pdfOptions = new PDFRenderOption( options );
//options.setOutputStream(arg0)
pdfOptions.setOption( IPDFRenderOption.FIT_TO_PAGE, new Boolean(true) );
pdfOptions.setOption( IPDFRenderOption.PAGEBREAK_PAGINATION_ONLY, new
Boolean(true) );
pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW,
IPDFRenderOption.FIT_TO_PAGE_SIZE);

}
options.setActionHandler(new MyActionHandler());

IRenderTask task = engine.createRenderTask(document);

task.setRenderOption(options);
//task.setPageRange("1-3");
task.setPageNumber(3);
//task.setReportlet("chart3");
task.render();
task.close();


Jason

On 5/11/2011 3:25 AM, forums-noreply@eclipse.org wrote:
> Hi,
>
> I am using Ruby and Birt, and here I use BIRT apis to get
> the rptdesign and then I show the report result as html
> content on the Page.
> Problem is I have thousands of records in that report and
> there is no paging coming in and which cause a lot of delay
> or Timeout issue. What is the way to add paging through
> APIs?
>
> I checked the apis and saw Irender has paging but not sure
> how I can utilize that.
>
> This is my code,
> factory = org.eclipse.birt.core.framework.Platform.createFactoryObject
> (IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY)
> engine = factory.createReportEngine(ENGINE_CONFIG)
> design = engine.openReportDesign(report_name)
>
> designHandle = design.getDesignHandle()
> designFactory = designHandle.getElementFactory()
>
> dsrc = designFactory.newOdaDataSource("DataSource",
> "org.eclipse.birt.report.data.oda.jdbc")
> dsrc.setProperty("odaDriverClass",
> BIRT_CONFIG['oda_driver_class'])
> dsrc.setProperty("odaURL", BIRT_CONFIG['oda_url'])
> dsrc.setProperty("odaUser", BIRT_CONFIG['oda_user'] )
> dsrc.setProperty("odaPassword",
> BIRT_CONFIG['oda_password'])
>
>
> designHandle.getDesignHandle().getModuleHandle().getDataSour
> ces().add(dsrc)
> @task = engine.createRunAndRenderTask(design);
> #Set parent class loader for engine
> @task.getAppContext().put(EngineConstants::APPCONTEXT_CLASSL
> OADER_KEY, CURRENT_THREAD.getContextClassLoader())
>
>
> Thanks
> Shivani
Re: BIRT report without WebViewer [message #676445 is a reply to message #669802] Sat, 04 June 2011 13:23 Go to previous message
shine_1611 is currently offline shine_1611
Messages: 20
Registered: April 2011
Location: Mumbai
Junior Member
hi Jason,

I tried the way you have mentioned here but it does not show the links to go to next page in HTML it is giving me a single html where i am getting complete html in one go.

And I see a display like PDF but I want to implement paging on the Html but this way it gives everything in single html. Is this the way it will work. see the attached screenshot. This screen represent two pages, which comes in single HTML.
What is the way to implement in the way shown in screenshot 2 (expectedPaging.png)

I have tried following properties
htmlOptions = HTMLRenderOption.new(options)
htmlOptions.setHtmlPagination(true)
htmlOptions.setHtmlRtLFlag(false)
htmlOptions.setDisplayFilterIcon(true)
htmlOptions.setEmbeddable(true)

Can you also tell me how can I embed the HTML to my page I made is true but what is the step further to render it on the page?

Thanks for the help
Shivani
Previous Topic:Empty PDF report downloaded as attachment from BIRT enabled web application
Next Topic:BIRT Exception when starting/stopping GlassFish 3
Goto Forum:
  


Current Time: Sat Oct 25 01:46:02 GMT 2014

Powered by FUDForum. Page generated in 0.03303 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software