mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 17:36:53 +01:00
Converts an existing performance-review prompt into 22 atomic knowledge articles under microsoft/knowledge/performance/, each paired with AL samples under samples/performance/<slug>/ demonstrating the anti-pattern and/or the best practice. The full set seeds the corpus the microsoft/skills/al-performance-review leaf skill matches against and validates the READ knowledge-file format end-to-end. Every article conforms to the READ contract: six required frontmatter fields, Description always present, no fenced code blocks, sample code referenced by repo-relative path. Each article is marked with a blockquote 'Seed article' note so domain stewards can extend or restructure them freely. Articles (ordered by concern area): Database query efficiency - use-findset-with-next (AA0181) - avoid-findfirst-with-next (AA0233) - only-fetch-records-you-use (AA0175) - use-findset-readonly-by-default - use-setloadfields-for-partial-records - use-addloadfields-in-report-layouts - use-calcsums-to-aggregate-filtered-sets (file: use-calcsums-for-flowfield-totals.md) - avoid-calcfields-in-loops - add-sift-keys-for-flowfields (AA0232) - use-isempty-for-existence-checks Filter and key optimization - filter-before-find - set-current-key-to-match-filters Temporary tables and transactions - use-temporary-tables-for-intermediate-data - keep-transaction-scope-short - avoid-user-interaction-in-transactions - avoid-commit-inside-loops Record operations - prefer-get-for-primary-key-lookups - use-insert-false-when-skipping-triggers - prefer-direct-record-over-recordref Strings, codeunits, events - use-strsubstno-for-message-formatting - use-single-instance-codeunits-for-caching - keep-event-subscribers-lightweight samples/README.md documents the sample-folder convention and makes clear the samples are demonstration-only, not derived from BC base application source, with unique object IDs in the 50100-50199 range. Rubber-duck pass caught: a misleading good.al in avoid-calcfields-in-loops (fixed by switching to a hoistable CalcFields scenario), an invalid event subscriber signature in keep-event-subscribers-lightweight (fixed by adding var xRec), normative guidance leaked into the Description of use-findset-readonly-by-default (moved to Anti Pattern), a missing sample pair for keep-transaction-scope-short (added), and muddy FlowField/CalcSums framing (retitled and clarified). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
27 lines
1.3 KiB
Markdown
27 lines
1.3 KiB
Markdown
---
|
|
bc-version: [26..28]
|
|
domain: performance
|
|
keywords: [sift, sumindexfields, flowfield, key, aa0232]
|
|
technologies: [al]
|
|
countries: [w1]
|
|
application-area: [all]
|
|
---
|
|
|
|
# Add SIFT keys for FlowField aggregations
|
|
|
|
> **Seed article.** Converted from an existing performance-review prompt to bootstrap the BCQuality performance corpus. Domain stewards should expand, restructure, and refine as needed.
|
|
|
|
## Description
|
|
|
|
CodeCop rule AA0232 checks that FlowFields backed by CalcSums or aggregation CalcFormula are supported by a key whose SumIndexFields include the summed field and whose key prefix matches the formula's filter fields. Without a SIFT key the platform falls back to a full aggregation on every read — typically invisible in development and catastrophic in production.
|
|
|
|
## Best Practice
|
|
|
|
For each Sum-style FlowField, ensure the source table has a key whose leading fields match the FlowField's CalcFormula WHERE clause and whose SumIndexFields list includes the summed field. Table extensions adding new FlowFields are responsible for adding the supporting key.
|
|
|
|
See sample: `samples/performance/add-sift-keys-for-flowfields/good.al`.
|
|
|
|
## Anti Pattern
|
|
|
|
Declaring a FlowField on a hot table without checking whether a supporting SIFT key exists ships a latent scan into every list page and report that touches the field.
|
|
|