Maxim Veksler
Maxim Veksler

Reputation: 30182

Rending reports with dynamic structure (Not template based approach)

I need a reporting framework that would allow me to create reports with dynamic structure.

Unlike Jasper Reports working mode in which you create a template for how your report will look like, I need exactly the opposite: I need a framework that will allow me to create reports with varying structure (Programmatic). The report is a table showing by which factors some result was calculated. The number of factors can vary, thus the number of columns in the table varies accordingly.

I would please like to know what reporting library can be used in the above described working mode.

Thank you for your time, Maxim.

Upvotes: 0

Views: 403

Answers (3)

Paul Jowett
Paul Jowett

Reputation: 6581

Docmosis is a reporting engine that uses templates, but you can conditionally drop columns, choose different tables, or include different sub-templates. Depending on HOW variable your layouts are it might be better to control it via a template than code.

Upvotes: 0

Maxim Veksler
Maxim Veksler

Reputation: 30182

BIRT Design Engine API was the tool I was looking for.

Upvotes: 0

Benoît Guérout
Benoît Guérout

Reputation: 1997

DynamicJasper may help you, here is an example extracted from tutorial:

        FastReportBuilder drb = new FastReportBuilder();
    DynamicReport dr = drb.addColumn("State", "state", String.class.getName(),30)
                    .addColumn("Branch", "branch", String.class.getName(),30)
                    .addGroups(2)
                    .setTitle("November 2006 sales report")
                    .setSubtitle("This report was generated at " + new Date())
                    .setPrintBackgroundOnOddRows(true)                      
                    .setUseFullPageWidth(true)
            .build();       

    JRDataSource ds = new JRBeanCollectionDataSource(TestRepositoryProducts.getDummyCollection());   
    JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), ds);
    JasperViewer.viewReport(jp);    //finally display the report report     

Upvotes: 1

Related Questions