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. XMap
  7. Libraries
  8. Schema Object
  9. Command Line Interface
  10. Scripts
  11. Parsers
  12. Script Ports
  13. Document Processors
  14. Formats
  15. Data Holders
  16. Anchors
  17. Transformers
  18. Actions
  19. Serializers
  20. Mappers
  21. Locators, Keys, and Indexing
  22. Streamers
  23. Validators, Notifications, and Failure Handling
  24. Validation Rules
  25. Custom Script Components

Data Transformation User Guide

Data Transformation 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.