Hi,
You mentioned in your initial post that you were grouping on Date and Machine, so I assumed (bad, bad) that Date was Group 1 and Machine was group 2.
If I can summarize what you are looking for, you want to display the largest number summed for the Date group within the Machine group.
Here is another stab at it:
@1_ResetValuesForMachineGroup
This will reset all variables used to their initial values every time that the Machine group changes.
This formula will go into the group header for the Machine group.
We're checking to see if the Group Header is repeating. If so, we don't want to reset the variables.
We're creating an array called "amt" to store the summary values for each date group.
We're setting the dimension of the array to the total number of different dates that will be in a particular Machine group.
We're setting a counter called "i", that we'll increment in the next formula, so that we store the value for each Date group in its own element in the array.
Code:
WhilePrintingRecords ;
If NOT InRepeatedGroupHeader then
(
Numbervar Array amt ;
NumberVar c := DistinctCount({Orders.Order Date},{@Machine}) ;
Redim amt[c];
NumberVar i := 1 ;
''
)
else ''
@2_CalcValues
This formula will be placed in the Group Footer for the Date group.
It will place the summarized value for the Date group into the array.
The counter "i" will be incremented so that the value for the next Date group will be placed into its own element in the array.
Code:
WhilePrintingRecords ;
NumberVar array amt ;
NumberVar i;
amt[i] := ( Sum ({@UnitPrice}, {Orders.Order Date},'daily') ) ;
i := i + 1 ;
@3_DisplayMax
Finally, we use the Maximum() function to pull the largest number out of our array to display it.
This formula would be placed in the group footer for the Machine group.
Code:
WhilePrintingRecords ;
NumberVar array amt ;
maximum(amt)
Bob Suruncle