Bind, Run, Rebind
Your team ships a small transformation pipeline that deliberately knows nothing about transformations: a caller plugs a transformer into the engine for the duration of one run, runs a batch of items, and unplugs it. The same session then runs the next batch with a different transformer — a pattern you will meet again the day you mock an external dependency in an AL test. The whole exercise is lifecycle discipline: two runs in one session must never see each other's state, and a run that dies halfway must never poison the run that retries after it.
Requirements
Create a codeunit named "Bound Pipeline Engine" with exactly these public procedures and, declared inside the same codeunit, exactly this integration event — the grading tests subscribe to it by this name and signature:
procedure Run(Items: List of [Text])
procedure GetProcessedCount(): Integer
procedure GetResult(Position: Integer): Text
[IntegrationEvent(false, false)]
local procedure OnTransformItem(Item: Text; var Result: Text; var Handled: Boolean)Engine rules:
Runwalks the items in input order and publishesOnTransformItemonce per item, withResultempty andHandledfalse on the way in — for every item, not just the first.- If a subscriber set
Handled, the engine appends that item'sResult— exactly the text the subscriber wrote, the engine adds nothing of its own — to the run log. - If no subscriber set
Handled, the engine raises an error whose text containsNo transformer is bound for item X, whereXis that item's text (matched as a substring, so extra words around it are fine — the phrase itself is exact).
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
- 13 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