Entries Carrying These Dimensions
The controller's request sounds trivial: "show me every entry on this account that was booked to both this project and this department." Then you open the G/L Entry table and find no project column and no department column — a ledger entry carries exactly one clue, an integer called "Dimension Set ID". Business Central stores every combination of dimensions ever used exactly once, in a normalized side table, and every ledger entry just points at its combination. To answer the controller you have to resolve through that store.
Requirements
Create a codeunit named "Dimension Set Search" with one public procedure:
procedure FindEntriesWithDimensions(GLAccountNo: Code[20]; RequiredDimensions: Dictionary of [Code[20], Code[20]]): List of [Integer]Rules:
- Only
G/L Entryrecords whose"G/L Account No."equalsGLAccountNoare candidates — entries on other accounts never appear in the result, however well their dimensions match. - Each dictionary entry is one requirement: the key is a dimension code, the value is the dimension value code that dimension must carry. A ledger entry matches when its dimension set satisfies every requirement — for each key, the set contains that dimension code with exactly that value code.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 12 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in