|
Re: Duplicate reports [message #808479 is a reply to message #806656] |
Mon, 27 February 2012 20:42 |
|
Instead of recreating the app context class every time why not just
create one and add some setters for result, motor and customer? Then in
the getAppContext method re-query for the results. If you do this
approach I assume your app context class will be static.
Another approach is the pass the result, motor and customer to the
report as url parameters and let the report create the reportData
object. You do this using the EMITTER_OPTIONS key:
HashMap myparms = new HashMap();
HashMap emitmap = new HashMap();
myparms.put("SERVLET_NAME_KEY", "frameset");
myparms.put("FORMAT_KEY", "html");
//myparms.put("RESOURCE_FOLDER_KEY", "c:/myresources");
myparms.put("ALLOW_PAGE", "false");
myparms.put("SHOW_PARAMETER_PAGE", "false");
emitmap.put("myurlparameter", "this is a test");
myparms.put("EMITTER_OPTIONS_KEY", emitmap);
WebViewer.display(rpt, browser, myparms);
In script you can then retrieve the url parameter like:
reportContext.getHttpServletRequest().getParameter("myurlparameter");
Jason
On 2/25/2012 3:55 AM, Timothy Vogel wrote:
> Issue
> I have an RCP application that uses BIRT for reporting. When I create a
> report on a model object the first time the object's data is correctly
> shown. When I create a report on a different model object the first
> object's data is displayed. Each report is opened in a different page
> within the application.
>
> Question
> How do I clear out the previous application context so that the 2nd
> object's data is displayed?
>
> Setup / Background
> - The report template is scripted from a Java object. - The Java object
> is passed in via an application context created in the manifest
> - The following code is called for each report
>
> WindingCardAppContext reportData = new WindingCardAppContext();
>
> // display the PDF allowing the user to print if desired
> Browser browser = new Browser(form.getBody(), SWT.NONE);
> Map<String, String> params = new HashMap<String, String>();
> params.put(WebViewer.SERVLET_NAME_KEY, WebViewer.VIEWER_FRAMESET);
> params.put(WebViewer.FORMAT_KEY, WebViewer.HTML);
> Preferences pref = ViewerPlugin.getDefault().getPluginPreferences();
> pref.setValue(WebViewer.APPCONTEXT_EXTENSION_KEY,
> "windingcard.appcontext");
> reportData.setResult(selectedResult);
> reportData.setMotor(editor.getMotor());
> reportData.setCustomer(this.customer);
> WebViewer.display(this.reportTemplate, browser, params);
> form.getBody().layout();
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 2.74201 seconds