5048

The Bank File From Hell

Integrations
Medium
Pro
csv
streams
parsing
bank-statement

The Bank File From Hell

Your customer's bank delivers statement files that are technically valid RFC 4180 CSV — and hostile in every way the standard allows: a UTF-8 byte order mark glued to the first header cell, descriptions quoted because they contain commas and even line breaks, doubled quotes inside quoted text, amounts exported as "1,234.56", and trailing empty columns. A quick split-on-comma importer silently produces garbage postings. You are writing the parser that survives the real file.

Requirements

Create a codeunit named "Bank Statement CSV Parser" with one public procedure:

procedure Parse(CsvInStream: InStream; var TempCSVBuffer: Record "CSV Buffer" temporary)

Parse reads the whole stream and fills the standard "CSV Buffer" table with one record per field: "Line No." is the 1-based record (row) number in file order, "Field No." is the 1-based field (column) number within its record, and Value is the decoded field text. Before filling, delete whatever the buffer already contains — callers reuse one buffer across files.

Parsing rules — this is the whole contract, and every rule is graded:

  1. Fields are separated by commas. Records end at a CRLF or at a bare LF; both terminators must be accepted. A terminator at the very end of the file is allowed and does not produce an extra record.
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
  • 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.

$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