5029

Partial Records, Full Price

partial-records
setloadfields
jit-load
item
sql-budget

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:

  1. Return one line per matching item, in ascending "No." order: the item's "No.", Description and margin joined by | (pipe), no extra spaces. The margin is "Unit Price" - "Unit Cost", rendered with Format(Margin, 0, 9), the region-independent XML format — e.g. TRYAL-1|Blue Bicycle|149.5.
The rest of the statement and 3 hints Unlock with Pro
ALBusiness Central 28.5
Pro
Pro problem

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.

$10 / month
or $100 / year
Upgrade
This problem is part of Pro
Pro unlocks the full statement, tests, hints and solution. The code editor works on a computer.
Upgrade