Accessing data via CurrentRow of dynamic list (CurrentRowAccess)¶
| Type | Scope | Severity | Activated by default |
Minutes to fix |
Tags |
|---|---|---|---|---|---|
Code smell |
BSL |
Major |
Yes |
2 |
performancebadpractice |
Description¶
Accessing data via CurrentRow of dynamic list (CurrentRowAccess)¶
Diagnostic description¶
Accessing properties or methods via CurrentRow of a dynamic list triggers a database object read per row. Use CurrentData instead, which works with already-fetched row data.
The diagnostic only fires for form tables displaying a dynamic list (type TableForm.DynamicList). Tables over tabular sections, value trees and other form data do not touch the database when accessing CurrentRow — no diagnostic is reported there.
Examples¶
Incorrect¶
Value = List.CurrentRow.Name;
List.CurrentRow.Write();
Correct¶
Value = List.CurrentData.Name;
See also¶
Snippets¶
Diagnostic ignorance in code¶
// BSLLS:CurrentRowAccess-off
// BSLLS:CurrentRowAccess-on
Parameter for config¶
"CurrentRowAccess": false