Results 1 to 12 of 12

Thread: Report Design

  1. #1

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Report Design

    How do i make a sub-total in CR9 like the one in the attached file?
    Attached Images Attached Images  
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  2. #2
    Addicted Member tsungik's Avatar
    Join Date
    Aug 2004
    Location
    Philippines
    Posts
    194

    Re: Report Design

    Hi,

    Add a group section to the report and compute for the sub-total. Be sure you have an identifying column so that you can group them.

    Hope this help.
    Begin with the end in mind.

    My Profile

    while( !( succeed = try() ) );

  3. #3

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Report Design

    i can get the sub-total for every client but may problem is how can i group the all client that start with SOCO and get the subtotal?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Report Design

    Create a formula that returns True/False by checking if the first 4 characters of the client field is equal to "SOCO". Then create a Group based on the formula.

  5. #5

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Report Design

    Quote Originally Posted by brucevde
    Create a formula that returns True/False by checking if the first 4 characters of the client field is equal to "SOCO". Then create a Group based on the formula.
    this is in CR? where can i find that in Cr?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  6. #6
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Report Design

    Yes in CR. I don't have CR9 but under the Insert menu there is probably an item that gets you to the Formula editor screen.

  7. #7

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Report Design

    if you have CR8.5 or 11 can you please show how it is done?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  8. #8

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Report Design

    This is what i have done so far. I have an SQL query to get the total by client and save it in a temporary table.

    vb Code:
    1. sSQL = "DELETE FROM tblTempMonthly"
    2.   oConn.Execute sSQL
    3.  
    4.   sSQL1 = "INSERT INTO tblTempMonthly " & _
    5.             "(ClientName, " & _
    6.             "Budget, " & _
    7.             "Purchases, " & _
    8.             "Selling)" & _
    9.   "SELECT tblClient.ClientName, " & _
    10.             "tblClient.ClientBudget,  " & _
    11.             "SUM(tblClient_Consume_Products.Purchases * tblClient_Consume_Products.Quantity) AS Purchases, " & _
    12.             "SUM(tblClient_Consume_Products.SalesPrice * tblClient_Consume_Products.Quantity) As Selling " & _
    13.   "FROM tblClient INNER JOIN " & _
    14.         "tblClient_Consume_Products ON  " & _
    15.         "tblClient.ClientID = tblClient_Consume_Products.ClientID " & _
    16.   "WHERE (tblClient_Consume_Products.DateOut BETWEEN '" & Format(DTPStart.Value, "mm-dd-yyyy") & "' AND '" & Format(DTPEnd.Value, "mm-dd-yyyy") & "' ) " & _
    17.   "GROUP BY tblClient.ClientName, tblClient.ClientBudget"
    18.   oConn.Execute sSQL1

    Result of the above query:
    ClientName Budget Purchase Selling
    SOCO-Apopong 960.00 55.50 63.82
    SOCO-Calumpang 960.00 56.25 64.68
    Doctor's Hospital 3000.00 72.75 83.66
    SOCO-Main 5000.00 147.75 169.90

    I used the records of temporary table in Crystal Report 9. I used grouped by clientname and here is the result:
    ClientName Budget Purchase Selling
    Doctor's Hospital 3000.00 72.75 83.66
    SOCO-Apopong 960.00 55.50 63.82
    SOCO-Calumpang 960.00 56.25 64.68
    SOCO-Main 5000.00 147.75 169.90
    Total 9920.00 332.25 382.06

    i want it to be like this:
    SOCO-Apopong 960.00 55.50 63.82
    SOCO-Calumpang 960.00 56.25 64.68
    SOCO-Main 5000.00 147.75 169.90
    Sub-Total 6920.00 259.50 298.40

    Doctor's Hospital 3000.00 72.75 83.66
    Sub-Total 3000.00 72.75 83.66
    Grand Total 9920.00 332.25 382.06
    Last edited by Simply Me; Nov 22nd, 2007 at 07:58 PM.
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  9. #9

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Report Design

    anyone who has an idea to share on how to solve the problem please?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  10. #10
    Fanatic Member
    Join Date
    Sep 2004
    Location
    Jakarta, Indonesia
    Posts
    818

    Re: Report Design

    i think u need some sort of Parent Table that hold 'smaller Company' so u can JOIN from there

    something like
    ParentTable = @parentID - ParentName
    @1 - SOCO
    @2 - Bank
    and at ur Current Table add new column that reference to ParentTable
    urCurrentTable = ... + ParentID
    ... + 1
    ... + 2
    so at the end u can say i want the total Consumption for SOCO, Bank, and so on

    PS: perhaps others can explain it better

    1st NF - a table should not contain repeating groups.
    2nd NF - any fields that do not depend fully on the primary key should be moved to another table.
    3rd NF - there should be no dependency between non key fields in same table.
    - E. Petroutsos -


    eRiCk

    A collection of "Laku-abis" Ebook, Permanent Residence

    Access Reserved Words, a Classic Form Bug, Access Limitation, Know run Process and the Lock they hold in, Logging User Activity in MSSQL,
    Kill Database Processes

  11. #11

    Thread Starter
    PowerPoster Simply Me's Avatar
    Join Date
    Aug 2003
    Posts
    2,748

    Re: Report Design

    The following are the contents of my tables:

    Under tblClient:
    ClientID ClientName Budget
    Client1 SOCO-Main 5000.00
    Client2 SOCO-Apopong 960.00
    Client3 SOCO-Calumpang 960.00
    Client4 Doctor's Hospital 3000.00

    Under tblClient_Consume_Products:
    ProductID ClientID Qty Purchases SalesPrice
    Prod0001 Client1 5.00 18.75 21.56
    Prod0002 Client1 3.00 18.00 20.70
    Prod0002 Client4 2.00 18.00 20.70
    Prod0001 Client3 3.00 18.75 21.56
    Prod0001 Client2 2.00 18.75 21.56
    Prod0002 Client2 1.00 18.00 20.70
    Prod0001 Client4 1.00 18.75 21.56
    Prod0002 Client4 1.00 18.00 20.70

    My query above came from two tables--tblClient and tblClient_Consume_Products and i created a temptable to save the result of my query. In CR I used temptable for my report.
    My tblClient has already ClientID column.

    Quote Originally Posted by erickwidya
    i think u need some sort of Parent Table that hold 'smaller Company' so u can JOIN from there
    Is the parent table different from my tblClient?

    Quote Originally Posted by erickwidya
    at ur Current Table add new column that reference to ParentTable
    are you referring to temptable?
    To give is always to be NOBLE...
    To received is always to be BLESSED....
    Each day strive to be NOBLE
    Each day strive to be BLESSED

    If this post has helped you. Please take time to rate it.

    >=|+|=< Simply Me >=|+|=<

    ----------------------------------------
    Connection Strings | Number Only in Textbox | Splash Screen with Progress Bar | Printing to 1/2 of perforated bond paper |
    Freeze 2005 DataGridView Column

  12. #12
    Fanatic Member
    Join Date
    Sep 2004
    Location
    Jakarta, Indonesia
    Posts
    818

    Re: Report Design

    Is the parent table different from my tblClient?
    of course, otherwise i wouldn't say new table, i think urCurrentTable is referring to ClientTable

    if u change it..just make sure u SELECT parentID column(or whatever name u use) so that in ur temptable u also have parentID and u can use JOIN from there

    like
    Code:
    SELECT ... from myTempTable INNER JOIN [ParentTable] ...
    WHERE [ParentTable].[Name] = 'SOCO' --or Hospital, Bank
    and in CR u can use GROUP by [ParentID] and get the result u want

    1st NF - a table should not contain repeating groups.
    2nd NF - any fields that do not depend fully on the primary key should be moved to another table.
    3rd NF - there should be no dependency between non key fields in same table.
    - E. Petroutsos -


    eRiCk

    A collection of "Laku-abis" Ebook, Permanent Residence

    Access Reserved Words, a Classic Form Bug, Access Limitation, Know run Process and the Lock they hold in, Logging User Activity in MSSQL,
    Kill Database Processes

Posting Permissions

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



Click Here to Expand Forum to Full Width