开发者

Variable calculation time

开发者 https://www.devze.com 2023-04-06 18:22 出处:网络
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.

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

精彩评论

暂无评论...
验证码 换一张
取 消