question regarding calcfields repeat-until

calyzto1
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.
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.
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.
0
Best 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 command0
Answers
-
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 command0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions