Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
CSV file from classical model
nishant_mintri
<p> Hi ,<br>
I am trying to generate a csv file from the Classical Model . I first generate the rptdocument and use it to create my csv file .<br>
When i view the CSV file , my column headers are displayed as the names of the Columns from the Classical Data Set .<br>
Can anyone explain me , why might this be happening ?<br><br>
Attached is my rpt design .</p>
<p> </p>
<p>And this is my code</p>
<p> </p>
<p>IEngineTask task=null;<br>
IRunTask runTask=null;<br>
String rptDocument = "c:\\reports\\testing2Csv"+".rptdocument";<br><br>
EngineConfig config = new EngineConfig();<br>
try {<br>
<br>
Platform.startup(config);<br>
ReportEngine engine = new ReportEngine(config);<br>
File csvFile = new File("c:\\reports\\testing2CsvFile.csv");<br>
<br>
ObjectOutputStream om = new ObjectOutputStream(new FileOutputStream(csvFile));<br>
<br>
//MY RPTDESIGN<br>
IReportRunnable design = engine.openReportDesign("C:\\documents\\columnordering.rptdesign");<br>
runTask = engine.createRunTask(design);<br>
runTask.run(rptDocument);<br>
<br>
<br>
//MY RPTDOCUMENT<br>
IReportDocument iReportDocument = engine.openReportDocument("c:\\reports\\testing2Csv.rptdocument");<br>
task = engine.createDataExtractionTask(iReportDocument);<br>
<br>
<br>
ICSVDataExtractionOption extractionOptions = new CSVDataExtractionOption();<br>
<br>
extractionOptions.setOutputFormat("csv");<br>
extractionOptions.setSeparator(",");<br><br>
extractionOptions.setOutputStream(om);<br>
extractionOptions.setOutputFile("c:\\reports\\testing2CsvFile.csv");<br>
<br>
IDataExtractionTask iDataExtractTask = (IDataExtractionTask)task;<br>
iDataExtractTask.extract((IExtractionOption)extractionOptions);<br>
System.out.println(task);<br>
<br>
<br>
<br>
}catch (BirtException e) {<br>
e.printStackTrace();<br>
} catch (FileNotFoundException e) { <br>
e.printStackTrace();<br>
} catch (IOException e) {<br>
e.printStackTrace();<br>
} <br>
<br>
}</p>
Find more posts tagged with
Comments
mwilliams
<p>The data extraction task extracts the data from the bound data set of an element in your report. To get the output as in your report layout, you'd need to create a CSV emitter.</p>
<p> </p>
<p>Here is one option that has been posted in the devshare:</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/801-csv-emitter-plugin-for-birt/'>http://developer.actuate.com/community/forum/index.php?/files/file/801-csv-emitter-plugin-for-birt/</a></p>
;
<p> </p>
<p>Or the Artorus emitters:</p>
<p> </p>
<p><a data-ipb='nomediaparse' href='
https://www.arctorus.com/arctorus-birt-emitters/features'>https://www.arctorus.com/arctorus-birt-emitters/features</a></p>
;
micajblock
<p>Also, the CSV output is a data export. The column headers in the CSV have nothing to do with the column headers in the report but are the binding names in the Table. The attached slightly modified report of yours should get the result you want.</p>
nishant_mintri
<p>Hi ,<br><br>
I am trying to generate a csv file from the Classical Model . I create my csv file using ICSVDataExtractionOption and IDataExtractionTask .<br>
When i view the CSV file ,I am only able to see the fields that are linked with the dataset elements and not the Header Rows defined in the rptdesign.</p>
<p> </p>
<p>Sippets of my code are : -<br><br>
ICSVDataExtractionOption extractionOptions = new CSVDataExtractionOption(); <br>
extractionOptions.setOutputFormat("csv");<br>
extractionOptions.setSeparator(",");<br>
extractionOptions.setOutputStream(output);<br>
IDataExtractionTask iDataExtractTask = (IDataExtractionTask)task;<br>
iDataExtractTask.extract((IExtractionOption)options);<br><br>
We are using WebLogic 10.3.6 as App server for deploying and Java version is 1.6.<br><br>
Can anyone explain me , why might this be happening ?<br><br>
Attached is my rptdesign