Nested Groups

Is it possible to nest Groups under Fast Reports

For example I have a dataset which has the following structure

Client Product Code Cost Description

I currently have a Group Header set to Client and a Master Data band set up with Product Code, Cost and Description, followed by a Group Footer showing a total per Client.

I would like to be able to display a sub total per Product Code, but when I insert a second group based on Product Code I get the "total" for the Product code across clients

Any pointers greatfully received...

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    2 group headers requires 2 group footers you must place the sumfunction in the correct footer
    gh1
    gh2
    mdband
    gf2 sum for product
    gf1 sum for client
  • edited 5:33AM
    gordk wrote: »
    2 group headers requires 2 group footers you must place the sumfunction in the correct footer
    gh1
    gh2
    mdband
    gf2 sum for product
    gf1 sum for client

    Thanks. That's what I had set up with the following problem.

    I think the problem I'm having is with the definition of the second group

    My Dataset is as follows

    Rec # Client Name Product Code Cost
    0 DK STAT 00 6.29
    1 DK STAT 00 15.99
    2 DK STAT 00 2.99
    3 DK TRAV EX 20.00
    4 MW SUBS PM 9.99
    5 MW SUBS PM 1.99
    6 MW TELE MO 0.99

    Just having a Group Header set to Client Name is fine

    Adding a second Group Header set to Break on Product Code results in the following output

    DK
    STAT 00
    6.29
    15.99
    2.99

    SUBS PM
    9.99

    MW
    TELE MO
    0.99

    As you can see the STAT 00 and TELE MO are correct, but there is no entry for TRAV EX for DK.
    Finally only one of the two SUBS PM entries for MW are listed, and is incorrectly under DK

    Any suggestions? I'm guessing I need an expression to break but what should it be?
  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    fr does not sort data
    your query must have an orderby clause or your table must be sorted
    the first field should be clientname second field product code
    the condition for the first group header is client name
    the condition for second group header is product code.
    see the main demo nested group report
  • edited 5:33AM
    gordk wrote: »
    fr does not sort data
    your query must have an orderby clause or your table must be sorted
    the first field should be clientname second field product code
    the condition for the first group header is client name
    the condition for second group header is product code.
    see the main demo nested group report

    I can't find the demo that you suggest - any idea where it should be?

    Dataset is correctly ordered (the index column is not in the dataset)

    The headers are set as you suggest.

    The problem seems to be that after the first three records, the dataset skips over the fourth record, and then assigns the fifth record to the wrong Client

    Dan
  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    the main demo is found in the programfiles/fastreports/fastreport 4/demos/main
    what version are you using
  • edited 5:33AM
    gordk wrote: »
    the main demo is found in the programfiles/fastreports/fastreport 4/demos/main
    what version are you using

    Fast Report 4 on Delphi XE6

    I've found the demo, and it appears to be doing what I need it to - just need to work out how!

    Thanks
  • edited 5:33AM
    I've had a bit more of a look and the issue appears to be with using a Pointer/TList and frxUserDataSet rather than the frxDBDataSet in the example - testing the same data on an frxDBDataSet works as expected.

    The issue with seems to be that there is an extra call to get Next when the Product Code changes, which means that it's the n+2, rather than n+1 entry that is listed, but the client name is now wrong.

    Any indicators on how I should be moving through the Tlist would be appreciated...
  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    have you writen code for the userdataset events
    onfirst, onnext and oneof
  • edited 5:33AM
    gordk wrote: »
    have you writen code for the userdataset events
    onfirst, onnext and oneof

    Yes - as below

    OnFirst
    ReadIndex := 0;

    OnNext
    Inc(ReadIndex);

    OnEof
    Eof := ReadIndex = ReadList.Count

    OnGetValue
    p := ReaadList[ReadIndex];
    if CompareValue...

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.