Dear Experts,
I have a very huge number of Customer Ledger Entries, and these lines of codes:
ReleaseSalesDoc - OnRun
...
recCustLedgerEntries.RESET;
recCustLedgerEntries.SETRANGE("Customer No.","Sell-to Customer No.");
recCustLedgerEntries.SETFILTER("Due Date",'<%1',"Document Date"));
recCustLedgerEntries.SETFILTER("Remaining Amt. (LCY)",'>0');
IF recCustLedgerEntries.FINDFIRST THEN
...
It will take about 15 secs. to do a Release Document.
I have also tried to change the use of FINDFIRST with recCustLedgerEntries.ISEMPTY, but no significant difference in performance.
Then I try this way:
recCust.GET(Rec."Sell-to Customer No.");
IF recCust.GETFILTER("Date Filter") = '' THEN
recCust.SETFILTER("Date Filter",'..%1',"Document Date");
recCust.CALCFIELDS("Balance Due (LCY)");
IF recCust."Balance Due (LCY)" > 0 THEN
This way, the running time is about 5 secs.
Any other brilliant ideas to get a better performance?
I am afraid with this very rapid growth records in this table in the future will lead to slow down in performance.
Thank you.
Comments
It depends very much on your NAV version/Build and the version of SQL server (if you use it) how slow or fast it will be without the SETCURRENTKEY.
Also: In a SETCURRENTKEY always use the full key and not only the first 2 or 3 fields.
FD Consulting
RIS Plus, LLC
Thank you all for sharing. I will give it a try.
Andwian
Isn't "Remainging Amt. (LCY)" calculated field? ;-) Filtering on it will be each time time-consuming...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Andwian
Andwian
Anyway, is it about next future performance, or just "that time" performance?
Andwian
Danke, einsTeIn.NET!
Glückliches neues Jahr
Andwian