Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Developing Analytics Applications
Crosstable doesn't show data but Dataset does
Migrateduser
<p>Hi,</p>
<p> </p>
<p>i integrated BIRT Runtime 4.5 into my application. Everything works fine. I can pass json as a parameter evaluate it and connect it to a scripted datasource. When i create a table with this datasource i see all passed values in pdf output. When i now want to use data cube functionality (connected to scripted dataset) the crosstabledoen't show any value.</p>
<p> </p>
<p>When i test it within eclipse with "run as > PDF" and pass the json parameter string through the parameter form i see values for the datacube in crosstable?</p>
<p> </p>
<p>Am i missing something?</p>
<p> </p>
<p>Here's my code how i run the report:</p>
<pre class="_prettyXprint _linenums:0">
public class BirtReportExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(BirtReportExecutor.class);
private File temp;
private static IReportEngine engine;
public static void main(String[] args) {
BirtReportExecutor pdf = new BirtReportExecutor();
try {
pdf.createPDFReport("","");
} catch (Exception e) {
e.printStackTrace();
}
}
public BirtReportExecutor() {
super();
try {
if(engine==null) {
LOGGER.info("Birt Engine initialization start");
EngineConfig config = new EngineConfig();
// no logging needed
config.setLogConfig(null, Level.OFF);
Platform.startup(config);
final IReportEngineFactory factory = (IReportEngineFactory) Platform
.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
engine = factory.createReportEngine(config);
LOGGER.info("Birt Engine initialization done");
}
} catch (BirtException e) {
e.printStackTrace();
}
}
public String createPDFReport(String json, String fields) throws Exception {
temp = File.createTempFile("report", ".pdf");
String absolutePath = temp.getAbsolutePath();
PDFRenderOption renderOptions = null;
renderOptions = new PDFRenderOption();
renderOptions.setOutputFormat(PDFRenderOption.OUTPUT_FORMAT_PDF);
renderOptions.setOutputFileName(absolutePath);
this.runReport(renderOptions,json,fields);
return "";
}
public File getTemp() {
return temp;
}
public void setTemp(File temp) {
this.temp = temp;
}
private void runReport(final PDFRenderOption renderOptions, String json, String fields) {
IRunAndRenderTask task = null;
try {
final IReportRunnable design = engine.openReportDesign("C:\\Users\\NAME\\Desktop\\Reporting\\report.rptdesign");
task = engine.createRunAndRenderTask(design);
System.out.println(json);
task.setParameterValue("json", json);
task.setParameterValue("fields", fields);
task.setRenderOption(renderOptions);
task.run();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (task != null) {
task.close();
}
if (engine != null) {
//engine.destroy();
}
//Platform.shutdown();
}
}
</pre>
Find more posts tagged with
Comments
There are no comments yet