bcquality/microsoft/knowledge/performance/isempty-before-findset-is-extra-round-trip.bad.al
Jesper Schulz-Wedde 42ff075793 Promote knowledge for Microsoft review skills
Move canonical knowledge for Microsoft-owned review domains into the Microsoft layer and document the skill/knowledge co-location policy.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2a6ea875-d38e-4f30-aadb-0d606f9be231
2026-09-03 14:59:44 +02:00

16 lines
502 B
AL

codeunit 50100 "IsEmpty Before FindSet Bad"
{
procedure ListUsCustomerNames()
var
Customer: Record Customer;
begin
Customer.SetLoadFields(Name);
Customer.SetRange("Country/Region Code", 'US');
// IsEmpty does not replace FindSet; it adds a second round-trip.
if not Customer.IsEmpty() then
if Customer.FindSet() then
repeat
Message(Customer.Name);
until Customer.Next() = 0;
end;
}