
To read more about the new BIRT 2.6 features see the BIRT New and Notable Features.
The Eclipse Business Intelligence and Reporting Tools project is an open-source project focused on the development and delivery of framework tools for reporting and business intelligence within the Eclipse platform.
importPackage( Packages.org.eclipse.birt.report.engine.api.script.element );
importPackage( Packages.org.eclipse.birt.report.model.api.simpleapi );
if(params["Region"].value!= null){
var filterCondition = StructureScriptAPIFactory.createFilterCondition();
filterCondition.setExpr("row['COUNTRY']");
filterCondition.setOperator("eq");
filterCondition.setValue1("params[\"Region\"]");
var filterKey = filterCondition.getStructure();
var filterItem = SimpleElementFactory.getInstance().createFilterCondition( filterKey )
this.addFilterCondition( filterItem );
}
// generic function to add a filter to a table
function addFilterItem (table, rowExpr, paramExpr){
var filterCondition = StructureScriptAPIFactory.createFilterCondition();
filterCondition.setOperator("in");
filterCondition.setExpr(rowExpr);
filterCondition.setValue1(paramExpr);
// could do in one step, shows DEAPI creation steps
var filterKey = filterCondition.getStructure();
var filterItem = SimpleElementFactory.getInstance().createFilterCondition( filterKey );
table.addFilterCondition(filterItem);
}
// add filters dynamically
if (params["Country"].value != null )
addFilterItem (this, 'row["COUNTRY"]' , 'params["Country"].value' );
if (params["City"].value != null)
addFilterItem (this, 'row["CITY"]' , 'params["City"].value' );
//RunAndRender Task
IReportRunnable design = null;
design = engine.openReportDesign("Reports/myreport.rptdesign");
IRunAndRenderTask task = engine.createRunAndRenderTask(design);
EXCELRenderOption options = new EXCELRenderOption();
options.setOutputFormat("xls");
options.setOutputFileName("output/resample/myxls.xls");
task.setRenderOption(options);
task.run();
task.close();
//or Render Task
IReportDocument document = null;
document = engine.openReportDocument("output/resample/myreport.rptdocument");
EXCELRenderOption options = new EXCELRenderOption();
options.setOutputFormat("xls");
options.setOutputFileName("output/resample/xlsoutput.xls");
IRenderTask task = engine.createRenderTask(document);
task.setRenderOption(options);
task.render();