Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WDESIGNER and version 24.0

After having defined the structure of the flat file, you can use the Flat File adapter to parse a flat file into this structure.

Drag the parse operation to your diagram as described on Flat File Adapter. Provide the flat file as a blob in parameter data or specify a path to a file in the filesystem, and provide an encoding or localization if necessary.
The path and file name of the file you want to access can be given dynamically via input parameter name, or statically via the definitions of a File alias.

The parsed file is returned as an object of the defined flat file structure.

Multiexcerpt include
MultiExcerptNameparameters_parse
PageWithExcerptFlatFile
shouldDisplayInlineCommentsInIncludesfalse

Flat File Adapter Parsing Process

The Flat File adapter parse action processes the parsing of a flat file using the following steps:

StepDescriptionExample
openOpen file or blob.
fileCreate FlatFile object. OrderFile
fetchFetch first record.
checkGo through all associations (FlatFileRecord and FlatFileGroup classes) until the first one matches depending on the tagged values evaluationOrder, lineNuber, condition, and pattern. Order




outIf no association matches, step out of the recursion and go to step check, abort with an error if there is no parent.
groupIf a group matches, create a FlatFileGroup object and go to step check. OrderLine
recordIf a record matches, create a FlatFileRecord object. OrderLine

attributeIf the FlatFileRecord class has attributes, process attributes using current record data. OrderID, customer, ...
nextFetch next record.
[...]
closeClose file and end Flat File adapter.

The following example shows the parsing process for a given class diagram. The names in the figure refer to the actions in the table above.

Inspecting the Parsing Process With the Scheer PAS Analyzer

You can inspect the parsing process of the Flat File adapter with the Analyzer. To view the parser trace file:

  1. Run a testcase with Full Trace option.
  2. Open the UML tab in the Analyzer.
  3. Navigate to the activity diagram that contains the Flat File adapter action.
  4. Click on the <<FlatFileAdapter>> action.
  5. Select Show adapter input/output > output from the context menu.
    The adapter output is displayed in the Watches section of the Analyzer.

  6. Right-click the displayed adapter output output and select Copy Value from the context menu.
  7. Paste the copied content into a text editor of your choice.

The output text shows the detail of the parsing process.

StepLog Item
First of all, it shows the FlatFile class that is going to hold the result of the parsing process.Start parsing flat file class "urn:Data_Model.FlatFile.OrderFile"
Then, it shows the pattern to be matched and the record that matches the pattern - if there is one.

"ORDER    1234    Winter & Partners    20230531    20230601"
Found record "orders" (class="urn:Data_Model.FlatFile.Order"): pattern "^ORDER.*" does match

If the records are nested hierarchically, the trace log will show the nesting as well by indenting the nested records.

"PRODQNTY    1    AF-1300    3    0000067.5 USD"
  Found record "lines" (class="urn:Data_Model.FlatFile.OrderLine"): pattern "^PRODQNTY.*" does match

  "LOCNQNTY    204    10"
    Found record "stockInfo" (class="urn:Data_Model.FlatFile.Stock"): pattern "^LOCNQNTY.*" does match

    "PRODQNTY    2    RC-0003    1    0000075. USD"
    Skipped record "stockInfo" (class="urn:Data_Model.FlatFile.Stock"): pattern "^LOCNQNTY.*" does not match
  Found record "lines" (class="urn:Data_Model.FlatFile.OrderLine"): pattern "^PRODQNTY.*" does match

Info

The parsing log file is only available if trace mode is activated. To have the complete log, additionally activate Full Trace.
On composing a file, no logs are available.

Panel
titleOn this Page:
Table of Contents
OtpFloatingfalse

Multiexcerpt include
SpaceWithExcerptINTERNAL
MultiExcerptNameFlatFileAdapter_ProductExport_Example
PageWithExcerptINTERNAL:_designer_examples
shouldDisplayInlineCommentsInIncludesfalse

rp
Panel
titleRelated Pages: