简体   繁体   中英

Jasper Reports : variables referencing other variables?

Inside a Jasper report, I'd like to have something with two non-cumulative variables (computed for each record):

var_age : a calculation of age based upon elements of the current record.

var_sanitized_age : something that takes var_age and changes its value if needed

So far it seems to me that I can't control in which order these variables will be computed. And that this could have var_sanitized_age either use var_age 's previous value, or fail.

Is there a way to have Jasper correctly compute one variable, with an expression that uses the values of one or several other variables?

And as a natural extension, could I the define a cumulative variable named var_sanitized_age_average that would reliably average upon one of the variable's latest value?

Variables are computed in the order in which they are declared in the report/dataset.

Therefore if var_sanitized_age depends on var_age , you need to be declare var_sanitized_age after var_age .

Computing the average of var_sanitized_age as var_sanitized_age_average would also work as long as the variables are declared in this order.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM