I've just started using crystal reports, and I'm having a problem.
I'm trying to make a report of items that is grouped by it's class. I need three different totals for each item. One when doctype=1, another when doctyp=2 and the last when doctype=3. Each item has lots of doctypes.
My question is, how do I obtain those totals?
Here's an example:
Budweiser Total1 Total2 Total3
Miller Total1 Total2 Total3
Coke Total1 Total2 Total3
Pepsi Total1 Total2 Total3
total1=sum for each item when doctype=1
total2=sum for each item when doctype=2
total3=sum for each item when doctype=3
In SQL terminology, what you are asking for is a report that is group(ed) by "class."
If you could be satisfied by presenting these totals (for a particular group) "immediately after" that group, then you can accomplish that requirement very simply with group-bands. Basically, Crystal Reports maintains the totals itself for each group and prints them out when it realizes that a particular group of records is complete.
On the other hand, if you require these totals to appear at the end of the report, after all of the rest of the output has been completed, then what you must do (unfortunately...) is to arrange for the results of an entirely separate SQL query to appear in that position; in other words, a "sub-report."
Quite frankly, I advise that you change the requirement. Put the group-subtotals after each group. "It's easier that way, much easier, and humans can adapt much more easily than computers can."