bcquality/microsoft/knowledge/performance/use-get-instead-of-findfirst-on-full-primary-key.good.al
Stefano Demiliani ac249ba4c9
Some checks failed
Validate knowledge index / validate-index (push) Has been cancelled
Validate AL review fixtures / validate-review-fixtures (push) Has been cancelled
Validate skill index and report schemas / validate-contract (push) Has been cancelled
Validate frontmatter and structure / validate (push) Has been cancelled
Preserve business filters when recommending Record.Get (#205)
2026-10-02 13:07:19 +02:00

31 lines
818 B
AL

codeunit 50210 "Perf Sample GetByPK Good"
{
procedure ShowName(CustomerNo: Code[20])
var
Customer: Record Customer;
begin
if Customer.Get(CustomerNo) then
Message(Customer.Name);
end;
procedure ShowUnblockedName(CustomerNo: Code[20])
var
Customer: Record Customer;
begin
Customer.SetRange("No.", CustomerNo);
Customer.SetRange(Blocked, Customer.Blocked::" ");
if Customer.FindFirst() then
Message(Customer.Name);
end;
procedure ShowUnblockedNameByKey(CustomerNo: Code[20])
var
Customer: Record Customer;
begin
if not Customer.Get(CustomerNo) then
exit;
if Customer.Blocked <> Customer.Blocked::" " then
exit;
Message(Customer.Name);
end;
}