Repeat options

To indicate the number of repeating groups:

  • Specify the number of repeats with a literal number in the HRL definition, or with a field name of the previous segment. For example, Segment.field1. Specify the number from a numeric field in a previous FRL/VRL that is defined within the same HRL.
  • Encase the repeating records within a beginning and ending string specified in the HRL.

Records repeat as long as a specified FRL/VRL field within the record matches a specified text.

For an HRL segment to be considered repeating, you must select one of the repeat options:

  • No Repeat indicates no repeats for the current HRL segment.
  • Repeats indicates the current HRL segment repeats. Specify in the adjacent text box the total number of repeats for the specified FRL, VRL, or another HRL file containing the format information for this HRL segment. The default is 1. This value can also be a field name of the previous segment. For example, Segment.field1.

    The Repeats text box can be a number or a field name of the previous segment.

  • Repeat Block specifies a particular block for repeating.

    The value of Begin or End is compared to the test data to determine where to repeat.

    For example, with a given HRL segment that uses BBB as the Begin and EEE as the End for repeating, and the test data is BBB111222333444555666777888EEE, then 111222333444555666777888 is the repeat block, which is parsed out according to the FRL file defined in the segment:

    Field
         0: ch >111<
         1: ch >222<
    Field1
         0: ch >333<
         1: ch >444<
    ---- End FRL Segment Segment(0) ----
    ---- Begin FRL Segment Segment(1) ----
    Field
         0: ch >555<
         1: ch >666<
    Field1
         0: ch >777<
         1: ch >888<
  • Repeat While repeats a specified file until the contents of Field does not contain the value specified in Value. The value of Field is an FRL/VRL field in the current HRL segment.
    Note: The GUI supports writing escape characters. For example, if you use "\x0a" in an HRL definition, the engine correctly escapes the character.

    Use this format for the field name:

    <VRL segment name>.field name 

    Example:

    To reference the field name Patient_ID in segment PID, use PID.Patient_ID.

    Any FRL/VRL/HRL segment in a HRL is not required. The Repeat While option checks the value from the first instance of the segment. If the first instance does not meet the condition, then the whole segment is skipped, and the segment is shown as empty during parsing.

    Example:

    An HRL is set to "Repeat While" on a five-character FRL segment Test, whose first character should be A:

    1. Message: ABCDEAfghiJkmnl ...
    Field Number: 1 
    Field Name: Segment_Test 
    --- Begin FRL Segment Segment_Test(0) ---
    Length of Repeat Field: 5 
    Repeat Field Offset from Field: 0 
    Field_1: >A<
    Field_2: >BCDE<
    ---- End FRL Segment Segment_Test(0) ----
    --- Begin FRL Segment Segment_Test(1) ---
    Length of Repeat Field: 5 
    Repeat Field Offset from Field: 5 
    Field_1: >A<
    Field_2: >fghi<
    ---- End FRL Segment Segment_Test(1) ----
    2. Message: ZBCDEzfghiJkmnl ...
    Field Number: 1 (empty)
    Field Name: Segment_Test