mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 17:36:53 +01:00
Correct performance knowledge guidance (#94)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 667c64a8-eb36-4440-bc41-6a97d8fb5542 Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
This commit is contained in:
parent
5706959e4a
commit
0e06485027
31 changed files with 279 additions and 261 deletions
|
|
@ -1,21 +1,32 @@
|
|||
codeunit 50128 "Perf Sample CommitInLoop Good"
|
||||
{
|
||||
procedure NormalizeCustomerNames()
|
||||
var
|
||||
LastCustomerNo: Code[20];
|
||||
begin
|
||||
// The outer loop owns checkpoints; the per-row loop contains no Commit.
|
||||
while NormalizeNextChunk(LastCustomerNo, 500) do
|
||||
Commit();
|
||||
end;
|
||||
|
||||
local procedure NormalizeNextChunk(var LastCustomerNo: Code[20]; ChunkSize: Integer): Boolean
|
||||
var
|
||||
Customer: Record Customer;
|
||||
RowsInChunk: Integer;
|
||||
ChunkSize: Integer;
|
||||
begin
|
||||
ChunkSize := 500;
|
||||
if Customer.FindSet(true) then
|
||||
repeat
|
||||
Customer.Name := UpperCase(Customer.Name);
|
||||
Customer.Modify();
|
||||
RowsInChunk += 1;
|
||||
if RowsInChunk >= ChunkSize then begin
|
||||
Commit();
|
||||
RowsInChunk := 0;
|
||||
end;
|
||||
until Customer.Next() = 0;
|
||||
Customer.SetCurrentKey("No.");
|
||||
if LastCustomerNo <> '' then
|
||||
Customer.SetFilter("No.", '>%1', LastCustomerNo);
|
||||
if not Customer.FindSet(true) then
|
||||
exit(false);
|
||||
|
||||
repeat
|
||||
Customer.Name := UpperCase(Customer.Name);
|
||||
Customer.Modify();
|
||||
LastCustomerNo := Customer."No.";
|
||||
RowsInChunk += 1;
|
||||
until (RowsInChunk >= ChunkSize) or (Customer.Next() = 0);
|
||||
|
||||
exit(true);
|
||||
end;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue