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)
Returning a status to Java from the BIRT Engine
lenburt
Hello out there -- we are using Eclipse BIRT 3.7 to produce documents. We invoke the BIRT engine passing the rptdesign, etc. and produce a PDF for printing or e-mailing. We have a requirement to 'fail' the document based on some business condition such as 'if account balance = zero, fail'. I have been able to create the conditional expression and i can generate a literal like 'FAIL!' to go on to the document, but i would like to set some internal status for the report generation that could be passed back to the Java process so it will know that something went wrong. Is this possible? I have not studied the runtime engine API much but this seems like a common request for developers.
Regards, len
Find more posts tagged with
Comments
CBR
You can use the appContext that is accessible in your report using the reportContext. Once the report is finished (task.run was executed) you can get back the AppContext (the task has method set/getAppContext).
My suggestion would be to add a object to the AppContext inside your report (the appContext is a java.util.HaspMap<String, Object>)
in your report:
reportContext.getAppContext().put("fail", new java.lang.Integer(1));
in your code:
runTask.run();
HashMap map = runTask.getAppContext();
if(map.get("fail")!=null && map.get("fail").intValue()==1) {
//do some fancy stuff here
}
lenburt
Good answer! - thx