#275 knowledge(performance): Get behind a key-is-set check in and-condition wastes a DB call
The boolean-operators-do-not-short-circuit article now covers Record.Get placed behind a key-is-set check in an and-condition. The pattern is not unsafe, but the Get is an unnecessary call when the guard means the key is not set.
- 3files
- 3AL files
- 0objects
Pull request · merged into main on 2026-11-18 by pri-kise · 3 files (+27 -2), 3 AL · feature · tier official · reviewed (checked by Opus)
What changed
- New anti-pattern signal: Rec.Get(Key) behind Key <> 0 or Key <> ‘’ when only a field value or default is returned
- Best practice: exit early with a guard clause, then call Get
- Get may be served from the server cache, so it is not always a database round-trip
- GetEntryDescription samples added to the bad and good files, both using SetLoadFields(Description)
- The existing article was extended instead of adding a new one
AL objects touched
microsoft/knowledge/performance/boolean-operators-do-not-short-circuit.bad.al: modified, not in the BC? snapshotmicrosoft/knowledge/performance/boolean-operators-do-not-short-circuit.good.al: modified, not in the BC? snapshotmicrosoft/knowledge/performance/boolean-operators-do-not-short-circuit.md: modified, not in the BC? snapshot
Context
- Systems: development, platform
Source: metadata of a merged pull request in microsoft/BCQuality (bcquality): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).