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)
Problems getting report data to display
bwinter
I've got the following code, which is attempting to write a pdf to the file system:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
ServletContext sc = request.getSession().getServletContext();
this.birtReportEngine = BirtEngine.getBirtEngine(sc);
IReportRunnable design;
//Open report design
design = birtReportEngine.openReportDesign( sc.getRealPath("/Reports") + "/grant-application.rptdesign");
//create task to run and render report
IRunAndRenderTask task = birtReportEngine.createRunAndRenderTask( design );
task.getAppContext().put(EngineConstants.APPCONTEXT_CLASSLOADER_KEY, CreateGrantAppReportRequestHandler.class.getClassLoader());
task.getAppContext().put("BIRT_VIEWER_HTTPSERVLET_REQUEST", request );
PDFRenderOption options = new PDFRenderOption();
options.setOutputFormat(HTMLRenderOption.OUTPUT_FORMAT_PDF);
options.setOutputFileName("c:\\fws\\reporting\\docs\\testing.pdf");
task.setRenderOption(options);
task.setParameterValue("projectId", "147080");
task.run();
task.close();
</pre>
<br />
The code appears to work in that it does write a PDF. However, the pdf is blank except for the report title and footer.<br />
<br />
Any idea why this is not getting data back? I ran it in my IDE and I can even see the parameter on the task before it gets executed. Hopefully I'm missing something silly.<br />
<br />
I did test this in the viewer and it works fine there.
Find more posts tagged with
Comments
bwinter
Earl in my log file I see this:
Jan 28, 2013 5:40:18 PM org.eclipse.birt.report.engine.api.impl.EngineTask setParameterValue
FINE: EngineTask.setParameterValue: projectId=147080 [java.lang.String]
But then further down, I see this:
InputParamBindings : InputParameterBinding(Name : projectId, Position : -1, Expression : ScriptExpression(Text:params["projectId"]))
ResultSetHints : org.eclipse.birt.report.data.adapter.internal.adapter.ColumnAdapter@29792d2c
ExtensionID : org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet
QueryText : select distinct ACL.NAME as NAME
from ACTION_CATEGORY_LUT ACL
left join PROJECT_ACTION_CAT_CROSS PAC on PAC.ACTION_CATEGORY_ID = ACL.ID
left join PROJECT P on PAC.PROJECT_ID = P.ID
WHERE P.ID = ?
PrivateProperties : {}
PublicProperties : {rowFetchSize=null, queryTimeOut=null}
)
Is that telling me that it doesn't have a paramter named projectId to access?
I'm also seeing many "invalidexpression" errors from queries that run fine elsewhere.
bwinter
I'm seeing this in the errors after the task has been run:
[org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information.
Invalid javascript expression: dataSetRow["NAME"] (Element ID:7)]
This is in a simple report that is accessing a single field from a data set. It works fine in the viewer.
Any ideas why this would blow up? I am running the same jdk (sun 1.6) everywhere and eliminated my js jar build path dependency and it still happens.
Thanks in advance! Let me know if I can provide anything that might help diagnose the problem
kclark
I compared your java to some code I wrote and it looks to be ok. Can you post the rptdesign for me to take a look at?
bwinter
Sure. I just threw this together to troubleshoot this problem.
I'm running this in an embedded eclipse tomcat server right now. From what I've been reading, this is likely due to some kind of javascript lib conflict?
Thanks for taking the time to take a look! It is very much appreciated!
bwinter
I ended up removing the js-1.6R5.jar from my project and replaced it with the js.jar file that came with the birt installation and things started working again! The 1-6R5 jar came from another project dependency.