Question 550
At fictional Ironwood Charities, the Business Central development team is supporting grant funding and accounting and reviewing object model and application extensibility during an extension maintenance sprint (MB820-3.6-122). The observed development issue is that a developer loops through thousands of sales ledger entries with Record variables merely to calculate a grouped total. Which Business Central or AL development principle best explains the right response?
Explanation
Correct Answer
The governing principle is that query objects can push aggregations into the data retrieval layer. The engineering response is to use a query object with an appropriate aggregation method and grouping columns. Verification should show that results match ledger totals while avoiding unnecessary per-row processing. Applied here, the relevant facts are: The observed development issue is that a developer loops through thousands of sales ledger entries with Record variables merely to calculate a grouped total. The question asks which Business Central or AL development principle best explains the right response.
Incorrect Answers
“Join choice decides whether unmatched parent rows survive” supports the separate task “select a supported outer-join or alternative query design that preserves missing related records”, not the reported problem: a developer loops through thousands of sales ledger entries with Record variables merely to calculate a grouped total. This case instead calls for “use a query object with an appropriate aggregation method and grouping columns”.
“Query join semantics determine cardinality and optional-record handling” concerns the separate step “define the DataItemLink and join type that match the intended relationship”. The reported issue is that a developer loops through thousands of sales ledger entries with Record variables merely to calculate a grouped total, so the direct response is to use a query object with an appropriate aggregation method and grouping columns.
The proposed “Aggregation granularity follows nonaggregated grouping columns” tests a different control: review grouping columns and Sum/Count aggregation placement. The reported condition is that a developer loops through thousands of sales ledger entries with Record variables merely to calculate a grouped total; the more direct action is to use a query object with an appropriate aggregation method and grouping columns.