SUM incorrect - not adding last Subreport value

0
Hi

I'm pulling my hair out with this one. I have a Master report and Subreport. The subreport contains a few detail lines, and a subtotal. The subtotal is being displayed correctly. This is passed back to the Master report as a variable. I have another variable set up to total this, which is then displayed in the Summary section.
However - the value of the total displayed in the Summary section, is always short the final subtotal.

I've tried searching the forum but have been unable to find a resolution to this.

Mentioned in this post: http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=8&id=20508#20508

was that it mattered what order you defined the variables.
If I define the total first, then the variable which contains the subtotal returned from the subreport - I get the scenario listed above. If I reverse the order and define the subtotal variable, then the total - the total displays null.

I'm more than a little confused by this behaviour... - is this working as expected?
How do I return a subtotal from a subreport, and print an overall total at the bottom of the master report???
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago

12 Answers:

0
I could never get this to work properly. I end up creating a separate class and using getter and setter to accumulate my totals.
svenn's picture
1258
Joined: Mar 19 2007 - 5:57am
Last seen: 10 years 5 months ago
0
I've followed what is described in this post, but still no resolution:
http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=8&id=19667#19667
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago
0
Please check if evaluation time for the total field is set to "REPORT". Only in this case all subreports are evaluated before.
mfassbender's picture
Joined: Aug 23 2007 - 7:30pm
Last seen: 10 years 3 days ago
0
mfassbender wrote:
Please check if evaluation time for the total field is set to "REPORT". Only in this case all subreports are evaluated before.

The total field is Variable, with Reset Type = Report. I don't see any evaluation time for the Variable.

For the text field that displays the total variable, I've tried Evaluation Time - Report, Now, Auto - all do the same thing - which is show the total not taking into account the last value returned from the subreport.
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago
0
svenn wrote:
I could never get this to work properly. I end up creating a separate class and using getter and setter to accumulate my totals.

Surely this is one of the most basic tasks of report writing - a Subtotal followed by a Total.

Frankly I'd be AMAZED if Jasper/iReports couldn't handle this kind of functionality without having to write it out separately in a scriptlet.

At this stage though there is no sight of a resolution, I'm unable to get any technical support on this, so may have to consider this convoluted approach to get around iReports/Jasper's shortcomings.....
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago
0
Has anybody got a simple total field that totals a subreport return parameter working???
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago
0
maybe submit a simple test for jasper peeps to see:

like 'Create' statements for simple tables,
then create a simple report with subreport doing basically same thing you want to try.
and post it here.

If their product is failing you, they should know bugs.
arianhojat's picture
Joined: Sep 18 2007 - 1:30am
Last seen: 9 years 11 months ago
0
I received a mail this morning from somebody having the same problem, so I thought I'd resurrect this thread and provide the example arianhojat was looking for.

I've attached a .zip file, containing a very basic subreport/report combination, and the 2 sql scripts needed to create the tables that the reports are based on.

To recreate a simple example of the problem, enter the 1st October as the from and to date for the report.

Thanks [file name=sample-2019c9c9ea8200d655f492229924651e.zip size=21749]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/sam...
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago
0
Hi.

My problem was very similar as yours. I had some return values from a subreport wich I summarized in my master. The last value from the subreport didn`t appear in the total in my master, even tough the value missing in my sum is visible in my master. This is what I did to save my day:

Where you define the bindings between master variable and return variable from the subreport, you can set calculation type to sum. (Fig. 8-20 in Toffoli`s Ireport guide from sept. 2007)
Based on this you can summarize over the entire report or groups etc. depending on the master report variables reset type.

This solved my problem, I guess this could be helpful for others also.
skalle's picture
9
Joined: Sep 3 2007 - 11:11pm
Last seen: 9 years 11 months ago
0
Ok I finally have seemed to be able to get the subtotals/totals to work now - thanks to the help from skalle!

However, I'm now having a problem working with those in the footer bands. I have created a report where I the subtotal is returned in minutes, and the correct value is available in the band (in the example it's displayed on the left). I have set up another couple of variable - 1 to give the time in minutes as hours, and the other to give it in minutes past the hour. So for example 187 minutes will be 3 hours, 7 minutes.

In the example that I have attached, in the first project footer the value in minutes is 120. However my variables display the value as null.

(to get a clear example, select 1st October 2007 as from and to dates)

Could someone please explain how to work with the subtotal value in a band?

Thanks [file name=calc_problem.zip size=22520]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/cal...
Post edited by: nealhudson, at: 2007/10/16 12:53
nealhudson's picture
Joined: Jul 4 2007 - 10:49pm
Last seen: 10 years 1 month ago
0

go to the variable properties and set 'Reset type' to 'Page' that solved the issue for me.

yamit3's picture
1
Joined: Mar 23 2012 - 2:10pm
Last seen: 5 years 5 months ago
0

Unbelievable that this has not been properly addressed. Most basic functions.

For me, the digits behind the comma do not add up correctly

sp's picture
sp
25
Joined: Oct 18 2013 - 6:57am
Last seen: 1 month 2 weeks ago
Feedback
randomness