Jump to content
We've recently updated our Privacy Statement, available here ×

Parameter based on parameter


leesy84

Recommended Posts

Hi

 

I have developed a report in iReport using 3 parameters and a jar file i have written. This first parameter is a filename the second a number both of these are prompted for the third parameter isn't prompted for and simply has a default value which is calling a java method i have wrote passing it the filename entered as param1.

 

This all works fine and runs on iReport however when i came to add it on jasperserver i add two controls to my report for filename and the number but don't add the third one as the default value will be picked up from the jrxml file? If i do this it seems to evaluate the thrid parameter before asking me for the filename so i get a filenotfound exception in my jar as it is being passed null. If i add it as a control i can't set the default value, or set the type to java.util.List and also i can also set prompt on all three controls not the individually.

 

I am sorry this is a long post it is my first post and not sure how much detail i need to enter

 

Thanks in advance for any help

 

Cheers

 

Daniel Lees

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

JasperServer evaluates the default value expression for all parameters in order to provide initial values for the report input control.

 

A solution for your case is to write a default value expression (for the third parameter) that checks whether the first parameter has a value:

Code:

<parameter name="Param1"/>
<parameter name="Param2"/>
<parameter name="Param3">
<defaultValueExpression>
$P{Param1} == null ? null : ..your expression..
</defaultValueExpression>
</parameter>

 

We could change JasperServer to silently ignore exceptions thrown while evaluating parameter default value expressions. If you think this should be done, please log it as a bug [url=http://jasperforge.org/sf/tracker/do/listArtifacts/projects.jasperserver/tracker.bugs]here.

 

Regards,

Lucian

Link to comment
Share on other sites

  • 12 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...