Partial Records, Full Price
The pricing team's nightly margin report walks every item of a catalog segment and prints three columns — number, description, margin — plus a grand total. The lines come out right, but the DBA winces at the trace: Item is one of the widest tables in Business Central, a few hundred columns plus a companion-table join per installed table extension, and every single row hauls all of it across the wire so the report can look at three fields.
Your job: the same report at a partial record's price — and without tripping over the two classic ways that price quietly snaps back to full.
Requirements
Your submission is the codeunit "Catalog Margin Report" from the starter, with one public procedure:
procedure BuildReport(var Item: Record Item): List of [Text]The procedure receives an Item record whose filters the caller has already set, and nothing has been read into it yet. Do the pass inside those filters, on that very record instance — the tests inspect the instance afterwards, so don't swap the work onto a copy or another object.
Rules:
- Return one line per matching item, in ascending
"No."order: the item's"No.",Descriptionand margin joined by|(pipe), no extra spaces. The margin is"Unit Price" - "Unit Cost", rendered withFormat(Margin, 0, 9), the region-independent XML format — e.g.TRYAL-1|Blue Bicycle|149.5.
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
- 6 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