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...
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
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?
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
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
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...
onfirst, onnext and oneof
Yes - as below
OnFirst
ReadIndex := 0;
OnNext
Inc(ReadIndex);
OnEof
Eof := ReadIndex = ReadList.Count
OnGetValue
p := ReaadList[ReadIndex];
if CompareValue...