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)
Multiple parameters within beforeOpen script
Erebel55
I am very confused and frustrated with this..I'm trying to have a report that has 2 prompts and the values of these should change the SQL for my dataset. However, for some reason when I add the second parameter to my script it messes everything up. Can someone please take a look at this?
I have attached 2 different attempts at this report..the script in question is the Result Query beforeOpen script. Can someone please help, I have no idea what is going wrong.
Find more posts tagged with
Comments
Erebel55
After looking at this longer, I found one problem I think..<br />
When I do this..for some reason it isn't entering the if here..I have no idea why it wouldn't because when I run I only select one value for this parameter..I even have it so multiple values aren't even supported yet. So why would this be happening?<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>// Parameter 2
var paramName = "ImpactSeverity"; //report parameter
paramLength = reportContext.getParameterValue(paramName).length;
// One impact assessment type was chosen
if (paramLength == 1)
{
// Replace the default phase type with the single user selection.
param = reportContext.getParameterValue(paramName);
this.queryText = this.queryText.replace( "High", param);
//this.queryText = this.queryText.replace( "AND info.CONFIDENTIALITY_IMPACT = ('High')", replaceString);
}</pre>
Erebel55
Is there some way I can test to see what paramLength is within Birt Report Designer? I'm very frustrated that this isn't working..it seems elementary that reportLength should be 1...
Erebel55
I have found the problem...but can someone please help me fix it?<br />
<br />
When I do this..<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>paramLength = reportContext.getParameterValue(paramName).length;</pre>
<br />
paramLength is returning as..<br />
<br />
function length() {/*<br />
int length()<br />
*/}<br />
<br />
What is this and how do I fix it? Someone please help.
Erebel55
Ok I solved the above...you cannot check the .length of the parameter like that unless you check the box for allow multiple values. But my script still isn't doing what I want it to.
Erebel55
Fixed everything.