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

Get parameter Values from filled JasperPrint


tmagalhaes

Recommended Posts

Is it possible to get the value of parameters from the filled JasperPrint object?

I could look at the JasperReport.getParameters, but that only gives me the default values passed into the report.

Our reports have some parameters that get their values from the underlying scriptlet and the optimal solution to our problem would be to peek the parameter value when the report finishes running.

An alternative would be to get the JasperPrint object to expose the scriptlet instance.

 

Any ideas?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

I'm not sure I understand what you want to do, but you could try use custom properties with expressions, at report level, and then you'll find them attached to the JasperPrint object.

Make sure you use custom properties with a name that starts with the "net.sf.jasperreports.export" prefix, or add your own prefix to the list of prefixes that JR recognizes when it transfers properties from the design model to the print model, using a config property like this:

net.sf.jasperreports.print.transfer.my_prefix=my.property.export.prefix

 

I hope this helps.
Teodor


 

Link to comment
Share on other sites

  • 4 weeks later...

I followed your suggestion but custom properties at report level dont support expressions as it seems. Its easy to get back a static value which you defined at properties on report level but i need to get a evaluated expression.

 

You can see this also when using iREport. On field properties level, you can check a "expressions" checkbox while on report level, you dont have that.

Marc

Link to comment
Share on other sites

You're right, Teodor missed the fact that report level properties cannot have expressions.  So if you want to get a parameter value from a JasperPrint object, you'll have to use one of the report elements to set the custom properties.

But if you want to get the calculated parameter value after the report runs (as in the original post), you can get it from the Map object that you pass to the fillReport method.

Regards,

Lucian

Link to comment
Share on other sites

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