Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Birt CSV report issue(org.eclipse.birt.report.engine.api.UnsupportedFormatException: The output format csv is not supported.)
Birt CSV report issue [message #1218579] Fri, 29 November 2013 10:40 Go to next message
Kosala Yapa is currently offline Kosala YapaFriend
Messages: 159
Registered: September 2010
Senior Member
Hi there,

I used the instructions in csv-emitter-birt-plugin at https://code.google.com/a/eclipselabs.org/p/csv-emitter-birt-plugin/.

I am passing a parameter map to Birt task and need to get a CSV output.

Here is the code:

String resourcePath = "C:/Pssu2/eclipse/resources/reports/";
FileInputStream fs = new FileInputStream(resourcePath+"partsList.rptdesign");

IReportEngine engine = null;
EngineConfig config = new EngineConfig();

// Your BIRT Runtime Directory Path, don't include ReportEngine in path name
config.setEngineHome("C:/Pssu2/birt-runtime-3_7_0/");
config.setLogConfig("C:/birt/logs", Level.FINE);
config.setResourcePath(resourcePath);

Platform.startup(config);

IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);

engine = factory.createReportEngine(config);
engine.changeLogLevel(Level.FINE);


// Your Report Design File Name here..
IReportRunnable design = engine.openReportDesign(fs);
IRunAndRenderTask task = engine.createRunAndRenderTask(design);

// Creating CSV Render Option object here..
CSVRenderOption csvOptions = new CSVRenderOption();
String format = CSVRenderOption.OUTPUT_FORMAT_CSV;

// Setting up various CSV Render Option before running the task

// CSV Render Option to set the output format
csvOptions.setOutputFormat(format);

// CSV Render Option to specify the output directory and file
csvOptions.setOutputFileName("reports/csvTest.csv");

// CSV Render Option to set if Data Type of column need to be rendered in second row of output
csvOptions.setShowDatatypeInSecondRow(true);

// CSV Render Option to Render a Table by Name
csvOptions.setExportTableByName("SecondTable");


// CSV Render Options to specify the delimiter
csvOptions.setDelimiter("\t");

// CSV Render Option to specify the character to be replaced if delmiter appears in actual text
csvOptions.setReplaceDelimiterInsideTextWith("-");


final Iterator<Entry<String, Object>> iterator = parameters.entrySet().iterator();
while (iterator.hasNext())
{
final Entry<String, Object> parameter = iterator.next();
task.setParameterValue(parameter.getKey(), parameter.getValue());
}

task.setRenderOption(csvOptions);
task.setEmitterID("org.eclipse.birt.report.engine.emitter.csv");

task.run();
task.close();

Platform.shutdown();
System.out.println("Report Generated Sucessfully!!");


I am getting an error:

org.eclipse.birt.report.engine.api.UnsupportedFormatException: The output format csv is not supported.
at org.eclipse.birt.report.engine.api.impl.EngineTask.setupRenderOption(EngineTask.java:2047)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:96)
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)


Any help to resolve this issue is appreciated.

cheers,

Re: Birt CSV report issue [message #1219442 is a reply to message #1218579] Tue, 03 December 2013 21:50 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

I used your code, minus the "setEngineHome" line with my own report and it works fine. You should remove that line as it's not needed with the 3.7.0 POJO runtime.

Michael

Developer Evangelist, Silanis
Previous Topic:How to convert rows to dynamic columns in Birt Report
Next Topic:Filtering dataset with multiple filters
Goto Forum:
  


Current Time: Tue Mar 19 08:07:19 GMT 2024

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

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

Back to the top