Processing Output very slow

Asiri
Asiri Member Posts: 26
Hi, to get the "Amount" for the selected customer and date period from the "Cust. Ledger Entry" table using the following code. But to show the output it is taking long time if there are lot of records for the customer. To speed up what the change need to do.
==========================================
RVCusLedger.RESET;
RVCusLedger.SETCURRENTKEY("Customer No.","Posting Date","Currency Code");
RVCusLedger.SETRANGE("Customer No.","No.");
RVCusLedger.SETRANGE("Posting Date",0D,DTOB-1);
IF RVCusLedger.FINDFIRST THEN
REPEAT
RVCusLedger.CALCFIELDS("Amount (LCY)",Amount);
DVOBLCY := DVOBLCY + RVCusLedger."Amount (LCY)";
UNTIL RVCusLedger.NEXT = 0;
==========================================

Comments

  • jubeljoy
    jubeljoy Member Posts: 154
    Taking too much time because of Flow fields.

    For faster outputs try to integrate the same with SQL procedure.
  • jubeljoy
    jubeljoy Member Posts: 154
    Taking too much time because of Flow fields.

    For faster outputs try to integrate the same with SQL procedure.
  • Albertvh
    Albertvh Member Posts: 516
    Hi,
    You could use the "Net Change" field on the customer
    your code will look like this
    Customer.SETFILTER("Date Filter",0D,DTOB - 1);
    IF Customer.FINDFIRST THEN BEGIN
      Customer.CALCFIELDS("Net Change");
      DVOBLCY := Customer."Net Change";
    END;
    

    Hope this helps.
  • apertierra
    apertierra Member Posts: 61
    edited 2015-09-08
    var mCustomer Record:18 (Customer);

    mCustomer.RESET;
    mCustomer.GET("No.");
    mCustomer.SETRANGE("Date filter",0D,DTOB-1);
    mCustomer.CALCFIELDS("Net Change (LCY)");

    DVOBLCY := mCustomer."Net Change (LCY)";
  • Asiri
    Asiri Member Posts: 26
    Thks a lot.