mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-06 23:26:55 +01:00
Correct severe misconception about SetCurrentKey in the knowledge base
This commit is contained in:
parent
841b4e7cab
commit
6e321d3c56
6 changed files with 74 additions and 40 deletions
|
|
@ -0,0 +1,18 @@
|
|||
codeunit 50230 "Perf Sample SetCurrentKey Good"
|
||||
{
|
||||
// SetCurrentKey is used because the rows must be processed oldest-first.
|
||||
// The sort is a functional requirement, so the ORDER BY it adds is justified.
|
||||
procedure ApplyOldestEntriesFirst(CustomerNo: Code[20])
|
||||
var
|
||||
CustLedgerEntry: Record "Cust. Ledger Entry";
|
||||
begin
|
||||
CustLedgerEntry.SetRange("Customer No.", CustomerNo);
|
||||
CustLedgerEntry.SetRange(Open, true);
|
||||
CustLedgerEntry.SetCurrentKey("Posting Date");
|
||||
if CustLedgerEntry.FindSet() then
|
||||
repeat
|
||||
// Apply entries in posting-date order ...
|
||||
until CustLedgerEntry.Next() = 0;
|
||||
end;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue