Variable calculation time
I want to calculate a string once (basicaly a concatenation) in a variable using the result of my report's query and then submit it to my subreports.
But for the moment it's calculated in 开发者_运维问答this order (let say operation A is my variable calculation and operation B is my subreport's call) :
A B A B A B ...
And what I'm looking for is A A A ... B B B (here every Bs have in parameter the last calculation of A).
Is there a solution which solve my problem like this (I guess it's a calculation time problem) ?
Thanks.
To change when a variable is calculated, you can use the resetType
and incrementType
attributes.
If you want it to only be calculated once (at the beginning of the report), set incrementType="Report"
. You will also have to change the variableExpression
to an initialValueExpression
.
Example:
<variable name="var1" class="java.lang.String" incrementType="Report">
<initialValueExpression><![CDATA[$F{foo}+$F{bar}]]></initialValueExpression>
</variable>
精彩评论