Options

question regarding calcfields repeat-until

calyzto1calyzto1 Member Posts: 2
Hi Guys, Kinda new here..

My issue is that i'm trying to calculate and sum all the 'remaining amount' entries in vendorledgerentry based on the start date and vendor no i'm entering in the report request page.
For example if its 11/24/2023 that i'm entering on the request page all the entries before this date's remaining amount should calculate for the particular vndor and display on my report table.

this is my coding and what i have tried so far, would appreciate if anyone could point me in the right direction.

Vendor Ledger Entry - (OnAfterGetRecord)
BforwardRemainingBalance := 0;
VendorLedgerEntry2.SETCURRENTKEY("Posting Date");
VendorLedgerEntry2.SETRANGE("Posting Date",0D,CALCDATE('<-1D>',"Start Date"));
IF VendorLedgerEntry2.FINDSET THEN
   REPEAT
      VendorLedgerEntry2.CALCFIELDS("Remaining Amount");
      BforwardRemainingBalance := BforwardRemainingBalance + VendorLedgerEntry2."Remaining Amount";
  UNTIL
     VendorLedgerEntry2.NEXT = 0;
     message('remaining bf is %1', BforwardRemainingBalance);

i'm getting a different value here which doesn't match with the excel file which i exported and summed with the correct filters, and the time it takes to load the report is too long.

Best Answer

  • Options
    DenSterDenSter Member Posts: 8,304
    Answer ✓
    The "Remaining Amount" field is a flowfield. Put your cursor in the field reference and hit F12, you will see the field definition in the Vendor Ledger Entry table. If you want to manipulate the results, you need to set the filter in the "Date Filter" field, and the flowfield should recalculate properly. No need for the SETCURRENTKEY command

Answers

  • Options
    DenSterDenSter Member Posts: 8,304
    Answer ✓
    The "Remaining Amount" field is a flowfield. Put your cursor in the field reference and hit F12, you will see the field definition in the Vendor Ledger Entry table. If you want to manipulate the results, you need to set the filter in the "Date Filter" field, and the flowfield should recalculate properly. No need for the SETCURRENTKEY command
Sign In or Register to comment.