Jump to content

BIRT Developer Center Download


Photo
- - - - -

Multiple parameters within beforeOpen script


  • Please log in to reply
5 replies to this topic

#1 Erebel55

Erebel55

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 16 November 2011 - 06:04 PM

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.

Attached Files



#2 Erebel55

Erebel55

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 16 November 2011 - 06:37 PM

After looking at this longer, I found one problem I think..
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?

// 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);

	}


#3 Erebel55

Erebel55

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 16 November 2011 - 07:21 PM

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...

#4 Erebel55

Erebel55

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 16 November 2011 - 07:35 PM

I have found the problem...but can someone please help me fix it?

When I do this..

paramLength = reportContext.getParameterValue(paramName).length;

paramLength is returning as..

function length() {/*
int length()
*/}

What is this and how do I fix it? Someone please help.

#5 Erebel55

Erebel55

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 17 November 2011 - 05:58 AM

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.

#6 Erebel55

Erebel55

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 17 November 2011 - 07:32 AM

Fixed everything.