bcquality/microsoft/knowledge/performance/use-setloadfields-for-partial-records.good.al
Jesper Schulz-Wedde 87ba36e650
Add BC performance knowledge from OptimAL learnings (#198)
* Add BC performance knowledge from OptimAL learnings

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

* Address review feedback on performance guidance

Clarify predicate-supporting keys versus covering queries, demonstrate proven cache reuse, and evaluate the updated partial-load and bulk-update rules.

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

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-29 17:21:28 +02:00

28 lines
897 B
AL

codeunit 50218 "Perf Sample LoadFields Good"
{
procedure CollectUSCustomerNamesAndCities(var DisplayNames: List of [Text])
var
Customer: Record Customer;
begin
Customer.SetRange("Country/Region Code", 'US');
Customer.SetLoadFields(Name, City);
if Customer.FindSet() then
repeat
DisplayNames.Add(CustomerDisplayText(Customer));
until Customer.Next() = 0;
end;
local procedure CustomerDisplayText(Customer: Record Customer): Text
begin
exit(Customer.Name + ' ' + Customer.City);
end;
procedure LookupSkuPolicy(LocationCode: Code[10]) Policy: Enum "SKU Creation Method"
var
Location: Record Location;
begin
Location.SetLoadFields("SKU Creation Policy");
if Location.Get(LocationCode) then
Policy := Location."SKU Creation Policy";
end;
}