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)
Dynamic list issue with passing report parameter
hallj05
<p>Hey,</p><p> </p><p>We are using Birt 4.2.2.</p><p> </p><p>We have the following onCreate script</p><p>this.action = this.createAction();
var dt = this.action.createDrillThrough();
dt.setReportName(row["ReportFile"]);
dt.setTargetWindow("_blank");
dt.setTargetFileType("report-design");
this.action.drillThrough = dt;</p><p> </p><p>The report names are pulled from an excel file data set.</p><p> </p><p>How would I get it to pass a report parameter (lang) to the next report?</p><p> </p><p>I've tried changing the setReportName so that it is like dt.setReportName(row["ReportFile"]+"&lang="+params["lang"].value);</p><p>but this causes me to get the following error when I click on the links</p><p><full report name>&lang=<value of lang> does not exist or contains errors.</p><p> </p><p>Thanks for any help!</p><p> </p>
Find more posts tagged with
Comments
micajblock
<p>Can you provide sample data?</p>
hallj05
<p>Well the only inputs this report has is the excel file which contains the reports file name in one column and in the second column gives a name to display as the text for the link to the report.</p><p> </p><p>This is basically a report that lists all the reports and gives links to go to them.</p><p> </p><p>Which I'm trying to figure out a way to pass the report parameter from this report to the next report. I've found ways to pass the parameter from all the other reports but this one is done different from the others.</p><p> </p><p>I've read something about using the function setParameterBindings but when I try to add it then I get errors.</p><p> </p><p>Here is how I was trying to use it in the script</p><p> </p><p>dt.setParameterBindings("lang",params["lang"].value);</p><p> </p><p>The error that it gives is Can't find method org.eclipse.birt.report.engine.script.internal.instance.DrillThroughInstance.setParameterBindings(string,string).</p>
hallj05
<p>Alright I've changed it around now and I get the error</p><p>Cannot call method "setParameterValues" of undefined</p><p>or</p><p>Cannot call method "setParameterBindings" of undefined</p><p> </p><p> </p><p> </p><p>I've changed the script to:</p><p> </p><p>this.action = this.createAction();
var dt = this.action.createDrillThrough();
dt.setReportName(row["ReportFile"]);
dt.setTargetWindow("_blank");
dt.setTargetFileType("report-design");</p><p>parameterMap = java.util.HashMap();
parameterMap.put("lang", params["lang"].value);
dt.IRunAndRenderTask.setParameterValues(parameterMap);</p><p>this.action.drillThrough = dt;</p><p> </p><p> </p><p>Any idea as to how it's undefined? Since everywhere I see online they do it something like this.</p>
micajblock
<p>Please provide sample data and version of BIRT you are using.</p>
hallj05
<p>We are using BIRT 4.2.2</p><p> </p><p>I've attached a sample report and a picture of what the excel file looks like, since it wouldn't let me attach the excel file.</p><p> </p><p>Currently the list part works, just need to figure out how to get it to pass the report parameter "lang" to the other reports when they are clicked from the list.</p>
hallj05
<p>I can get the parameter passing to work if passing via a chart or by a defined hyperlink, but can't seem to get it working when using a dynamic list.</p><p> </p><p>Is there a way to pass the parameter value to a report library and then call the parameter on other reports? Since the 'lang' value will be getting passed in to BIRT via the URL and only needs to be accessed on a couple of reports, which the only way I could think of was to pass the value from report to report to get the value of 'lang' to the reports that need it. Since we have lots of sub reports that are accessed only through drilling down and the report that is giving issues on passing the parameter is the one that contains all the links to the top level reports.</p>
hallj05
<p>Alright, I got it working. Ended up not having the "new" keyword when defining the parameterMap.</p><p> </p><p>Here is the final script.</p><p> </p><p> </p><p>this.action = this.createAction();
var dt = this.action.createDrillThrough();
dt.setReportName(row["ReportFile"]);
dt.setTargetFileType("report-design");
parameterMap = new java.util.HashMap();
parameterMap.put("lang", params["lang"].value);
dt.setParameterBindings(parameterMap);
dt.setTargetWindow("_blank");
this.action.drillThrough = dt;</p>