Results 1 to 4 of 4

Thread: Newbie

  1. #1
    Join Date
    Feb 2004
    Location
    El Salvador
    Posts
    46

    Unanswered: Newbie

    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:

    Beer
    Budweiser Total1 Total2 Total3
    Miller Total1 Total2 Total3
    Soda
    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

  2. #2
    Join Date
    Oct 2003
    Posts
    706
    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."
    ChimneySweep(R): fast, automatic
    table repair at a click of the
    mouse! http://www.sundialservices.com

  3. #3
    Join Date
    Mar 2004
    Location
    Calgary, AB Canada
    Posts
    7
    Are you looking for this formula?

    if DocType = 1 then
    FieldToTotal
    else
    0

    You'll have two more for DocType = 2 and DocType = 3 and on and on...

    Add the new formulas to the report and add sub-totals for them.

    Is that what you're looking for?

    Djangman

  4. #4
    Join Date
    Feb 2004
    Location
    El Salvador
    Posts
    46
    yes, thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •