Distinct Count
I need to distinct count the customer number in Fastreport, How I can do this?
GroupHeader1 <Cust No>
MasterData1 [Cust No, Cust Name, Invoice No, amount]
GroupFooter1 [Distinct Count <Cust No>, Count <No of Invoice>
Best Regards
Leslie
GroupHeader1 <Cust No>
MasterData1 [Cust No, Cust Name, Invoice No, amount]
GroupFooter1 [Distinct Count <Cust No>, Count <No of Invoice>
Best Regards
Leslie
Comments
in editmode select the aggregate button and build your aggregate expression.
var LastCustNo : string;
TotalCustomers : integer;
procedure OnGroupHeader1.OnBeforePrint; << create this one by double-clicking in the event in the object inspector
begin
if LastCustNo <> (<Datasetname."Cust No">) then // << check the syntax here, with other examples, I'm not 100% sure
inc(TotalCustomers);
LastCustNo := <Datasetname."Cust No"> // << check the syntax here, with other examples, I'm not 100% sure
end;
function GetCustomerCount: string;
begin
result := inttostr(TotalCustomers);
end;
Then in the page editor, in the MemoView where you have [Distinct Count <Cust No>], simply make its text value exaclty as the next line:
[GetCustomerCount]
Should work, with some minimal adjustments.
I hope it helps
It Work!
Thank a lot!
Best Regards
Leslie " border="0" alt="laugh.gif" />" alt=">" />