Jump to content
Changes to the Jaspersoft community edition download ×

Parameter Calculation


Recommended Posts

By: F. Harasleben - friedrichh

Parameter Calculation

2006-07-14 05:58

Would it be possible to calculate a parameter based on another parameter, to be used in the datasource:

 

like reports gets parameter P=2006

and P1 should be P1=P-1

 

rgds

friedrich

 

 

By: Lucian Chirita - lucianc

RE: Parameter Calculation

2006-07-14 06:04

Yes, you can use the default value expression of the parameter to do this. Note that the order of the parameters matters, you will need to declare P1 after P.

 

HTH,

Lucian

 

 

By: F. Harasleben - friedrichh

RE: Parameter Calculation

2006-07-17 00:37

Lucian

 

I tried but now get the following error (I am using iReports 0.5.0 to create/compile my reports) when creating the query based on the reports: "General problem: Source file: inline evaluation of: ....."

 

What I did is:

create a string parameter P_ACC_YEAR and a secont parameter P_AM_CY_FROM based on the first one default expr = "01.01.".concat($P{P_ACC_YEAR})

 

when I use "01.01.".concat("2006") instead it works.

 

friedrich

 

 

By: Lucian Chirita - lucianc

RE: Parameter Calculation

2006-07-17 07:31

Could you be more specific, i.e. post relevant JRXML fragments (parameter definitions) and the full exception stack trace?

 

 

By: F. Harasleben - friedrichh

RE: Parameter Calculation

2006-07-17 07:54

This are the parameter definitions

<parameter name="P_ACC_YEAR" isForPrompting="false" class="java.lang.String">

<defaultValueExpression ><![CDATA["2006"]]></defaultValueExpression>

</parameter>

<parameter name="P_AM_YEAR_FROM" isForPrompting="false" class="java.lang.String">

<defaultValueExpression ><![CDATA["01.01.".concat($P{P_ACC_YEAR})]]></defaultValueExpression>

</parameter>

 

 

The excetion comes from iReports, when trying to read the fields for the Query.

 

 

 

By: Lucian Chirita - lucianc

RE: Parameter Calculation

2006-07-17 08:37

Does this exception originate in the JasperReport engine or is it an iReport related exception?

 

In the latter case, I think you should post a question on the iReport forum.

 

Otherwise, I'd need the exception stack trace to tell what's wrong.

 

 

By: F. Harasleben - friedrichh

RE: Parameter Calculation

2006-07-18 01:22

I think it comes from iReport (not quite sure) and I already posted a question there - but no answers so far.

 

In the meantime I change the logic of my report and intstead of calculating nested parameters I do the calculation in the SQL query itself - and this works without problem.

 

Anyway thanks very much for your help.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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