title | description | ms.author | ms.date | ms.topic | author | ms.reviewer |
---|---|---|---|---|---|---|
CodeCop Warning AA0181 |
Avoid getting the dataset when an enumeration is not used, which will decrease performance. |
solsen |
05/14/2024 |
reference |
SusanneWindfeldPedersen |
solsen |
The FindSet() or Find() methods must be used only in connection with the Next() method.
Avoid getting the dataset when an enumeration is not used, which will decrease performance.
If you use FindSet()
or Find()
you must have a Next()
method. Otherwise, you are wasting CPU and bandwidth since multiple records are loaded but you only use one.
codeunit 1 MyCodeunit
{
var
customer: Record Customer;
procedure Foo()
begin
if customer.FindFirst() then
repeat
...
until customer.Next() = 0;
end;
}
codeunit 1 MyCodeunit
{
var
customer : Record Customer;
procedure Foo()
begin
if customer.FindSet() then
repeat
...
until customer.Next() = 0;
end;
}