Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subtotal - how stupid can i be?

Status
Not open for further replies.

dean12

MIS
Oct 23, 2001
273
US
So I have a dataset like this:

Invoice Line# Line$ Inv $
101 1 50 100
101 2 25 100
200 1 50 50

I want to output the Invoice # and $ in a group and the line items in a detail like this:

Invoice Invoice $
101 100

Item
1 50
2 25

200 50

Item
1 50

Now I need to add a total on invoice and I expect to see $150. Unfortunately I get $250. So I think that I need to be incrementing the total for the invoice ONLY when the group header prints.

Does this make sense?

Is this outside the scope of CR8.5 - do I have to do this manually?

 
Well first off I would have expected the total for Invoice 101 to be $75 not $100...unless there are two of Item 2 which isn't shown in your example.

Then the total of all invoices would be $125

But that might just be a typo.

a couple of questions:

1. Are you using Running Totals or Summary totals or manual totals for your Invoce sums individually and also for the Grand Total?

2. Are you suppressing any details of item #...if you are then a manual total based on a formula might be necessary?

Describe what you are doing in a little more detail...

What you are trying to do is certainly routine for CR8.5... but you have obviously made a mistake...just give us the details and we should find a solution. Jim Broadbent
 
You can do this in Crystal, but keep in mind that you have data which has repeating Inv$ values per line item, so you have to ignore those.

Create a formula in the report header:

//Initialize the variable
whileprintingrecords;
global numbervar InvTotal :=0;

And in the group Header:

// Reads only one record per group
whileprintingrecords;
global numbervar InvTotal;
InvTotal := InvTotal + {MyTable.InvField}

Now you can place this total in the report footer:

whileprintingrecords;
global numbervar InvTotal;
InvTotal

Something like that...

-k kai@informeddatadecisions.com
 
Kai is right. But there is an easier way. Just create a running total that sums the amount field and evaluates once per group (based on invoice number). Choose 'never' for the reset option.

You will now have an accurate grand total that you can display on the report footer.
Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Well you are correct in that it was a typo on my figures presentation.

I'm going to look into both of these solutions.

thanks very much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top