Table of Contents

Search

  1. Preface
  2. Introduction to Data Transformation
  3. Data Processor Transformation
  4. Wizard Input and Output Formats
  5. Relational Input and Output
  6. Using the IntelliScript Editor
  7. XMap
  8. Libraries
  9. Schema Object
  10. Command Line Interface
  11. Scripts
  12. Parsers
  13. Script Ports
  14. Document Processors
  15. Formats
  16. Data Holders
  17. Anchors
  18. Transformers
  19. Actions
  20. Serializers
  21. Mappers
  22. Locators, Keys, and Indexing
  23. Streamers
  24. Validators, Notifications, and Failure Handling
  25. Validation Rules
  26. Custom Script Components

User Guide

User Guide

Example

Example

A Parser processes input with the following structure:
ST*12*23~ NM1*12*23*4~ N1*12*23~ NM1*13*23*4~ N2*1*2*3~ SE*12*2:3:4~
The records are delimited by newline characters. Within each record, the fields are delimited by
~
,
*
, and
:
characters.
The first field of each record identifies the record type. There are five main record types:
ST NM1 N1 N2 SE
In the
NM1
records, the second field is a subtype. There are two subtypes:
NM1*12 NM1*13
The records must occur in the following sequence:
  1. An
    ST
    record.
  2. An
    NM1*12
    record followed by
    N1
    .
  3. An
    NM1*13
    record followed by
    N2
    .
  4. An
    SE
    record.
You can parse this input by configuring a
StructureDefinition
anchor.
The
format_definition
property contains a
RepeatingGroup
that finds the records. The
RepeatingGroup
performs the following operations:
  1. It finds the record content, up to the newline delimiter.
  2. It extracts the record-type identifier, such as
    ST
    or
    NM1
    , and stores it in the
    $id
    variable.
  3. If the record type is
    NM1
    , it extracts the subtype (
    12
    or
    13
    ), and stores it in the
    $qualifier
    variable.
  4. It runs an
    ExtractRecord
    anchor that passes the record to the subelements.
    ExtractRecord
    attaches the
    $id
    and
    $qualifier
    identifiers to the record.
The element is configured to match any record that has the identifier
ST
.
The
format_definition
encounters the first input record and passes it to the subelements. The first record matches the first subelement because it has the
ST
identifier. The first subelement contains
Content Marker Content
anchors, which parse the record.
The second subelement defines a sequence of nested subelements. The first nested subelement matches a record having the identifiers
NM1
and
12
. The second nested subelement matches a record having an identifier of
N1
.
The second and third input records are
NM1*12
and
N1
. These match the sequence of subelements. Each nested subelement parses the corresponding record.
Suppose that the second and third records were
NM1*12
and
N2
. These do not match the subelements hierarchy, so they would not be parsed.
The next records are
NM1*13
and
N2
. They match the third subelement, named
Loop2000
.
The last record is
SE
, matching the last subelement.
All the input records match the subelements hierarchy, so the
StructureDefinition
successfully parses the complete input.

0 COMMENTS

We’d like to hear from you!