How to count the total number of the customers

Horse06Horse06 Member Posts: 496
Hi Expert, I need your help and advice.
In the customer Sales Analysis report, I have three tables: Customer Table, Value Entry Table and Res. Ledger Entry Table. How to count the total number of the customers based on the date range and put the total number at the customer footer. Thanks!

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • Horse06Horse06 Member Posts: 496
    Thank you Mark! I have tried the following.

    Declare intcounter as decimal
    In the Customer OnaftergetREcord
    intcounter :=1

    In the customer onpreDataitem
    CurrReport.CREATETOTALS(intCounter);

    In the Customer footer, intCounter shows the total number of all of the customers in the system (e.g in the following report, total number of customers is showing as 330 instead of 3). How to get the correct numbers of the total customers as below:

    Customer Sales Analysis

    5/10/13-5/20/13
    Customer A
    Customer B
    Customer C

    Total number of the customers: 3

    Thank you!
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    What about forgetting the CREATETOTALS-function and put intcounter :=intcounter + 1 in the OnAfterGetRecord-trigger of the Customer-DataItem?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Horse06Horse06 Member Posts: 496
    No, it doesn't work, still showing the total number of the customers. Thank you!
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Are you skipping records or only showing customers with details?
  • Horse06Horse06 Member Posts: 496
    Thank you for your response! I didn't skip any records. I also tried to view both the summary and detailed report,
    but have the same result. I tested using one day report and even thought there are a total of 10 records showing, but
    the numbers is showing 500. Thank you!
  • Horse06Horse06 Member Posts: 496
    Hi expert, is there any solutions for this? Thank you!
  • chichi Member Posts: 17
    Is the date range applied on the Value Entry Table? If my understand is correct, I think code should be put as the following:

    Declare FirstTime as boolean.

    In Value Entry Table - OnPreDataItem
    FirstTime := False;

    In Value Entry Table - OnAfterGetRecord
    IF FirstTime = False THEN BEGIN
    incounter := incounter + 1;
    FirstTime := True;
    END;
  • Horse06Horse06 Member Posts: 496
    Hi Chi, your understanding is right and thank you for your response! But I aslo need to filter salesperson as well in the customer table, and then filter the date in the value entry table.
    I added intcounter in the value entry groupfooter and footer sections and per your instructions, I added the codes, but it doesn't work. Please advise! Thank you very much!
  • Horse06Horse06 Member Posts: 496
    Hi Chi. I fixed something and it is now working. Thank you very much!
Sign In or Register to comment.