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

Subreport return value is null


javabean

Recommended Posts

Hi all,

 

I have a master report and a subreport and need to return a BigDecimal value from subreport in detail band, then need to summary this return value. But this value always return null, if I set the calculation type of the received variable to "System", I can return it but it loss the last one and fill null to the first one.

 

For example, in subreport the value is shown as 1,2,3, but in masterreport the return value is null,1,2.

 

Can anyone help me? Thanks.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

If you want to display a returned value in the same band, you'll have to set evaluationType="Band" for the text field. And if you want to sum returned values, you'll have to create a new variable and set calculation="Sum" when returning the value:

Code:

<variable name="ReturnValueSum" class="java.lang.Integer" calculation="System"/>
...
<subreport>
<returnValue subreportVariable=".." toVariable="ReturnValueSum" calculation="Sum"/>
</subreport>

 

HTH,

Lucian

Link to comment
Share on other sites

Hi lucianc,

 

I am afraid that it doesn't work. Below is the coding,

 

<variable name="GrandTotByDate" class="java.lang.Integer" resetType="Report" calculation="System">

 

<returnValue subreportVariable="TOTALBYDATE" toVariable="GrandTotByDate" calculation="Sum"/>

 

The result is null, and subreportVariable "TOTALBYDATE" is already Integer.

 

On the other hand, when I set evluation time to "Band", the textfield disappear. Below is the coding.

 

<variable name="TotalByDate" class="java.lang.Integer" resetType="Report" calculation="Nothing">

 

<returnValue subreportVariable="TOTALBYDATE" toVariable="TotalByDate"/>

 

<textField isStretchWithOverflow="true" pattern="###0" isBlankWhenNull="false" evaluationTime="Band" hyperlinkType="None" hyperlinkTarget="Self" >

..

<textFieldExpression class="java.lang.Integer"><![CDATA[$V{TotalByDate}]]></textFieldExpression>

 

Is there anything wrong, please advise, thanks.

Link to comment
Share on other sites

javabean wrote:

<variable name="GrandTotByDate" class="java.lang.Integer" resetType="Report" calculation="System">

<returnValue subreportVariable="TOTALBYDATE" toVariable="GrandTotByDate" calculation="Sum"/>

The result is null, and subreportVariable "TOTALBYDATE" is already Integer.

 

That's strange. Do you have a full sample that shows this?

 

On the other hand, when I set evluation time to "Band", the textfield disappear.

 

Note that text fields that have delayed evaluation do not stretch. Make sure you set the text field height to a value large enough to fit the text.

 

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