Splf extractor: Expanable parent

Splf extractor: Expanable parent

In the spooled file extractor it is possible to build a tree structure in the output XML. One challenge can however be, that you want a header mapping have a variable length to include a variable number of extra detail lines, that should be configured as children.

 

You can setup an option on the mapping for the child node to do that:

 

NG2SFE0045

 

If you e.g. consider this example, then this option can help you:

 

NG2SFE0046

 

In the area of the detail lines there are two kinds of detail lines: A header detail line (marked above) with a number on the left side and extra description lines (there are 1 or many of these for each header detail line), that are blank in the same positions. We want to build an output XML file with a flexible output like below:

 

NG2SFE0047

 

Here the Body node is defined to contain the full area of the detail lines, and the Position node is selected for each line, where there is a number on the left side:

 

This is achieved with this definition:

 

NG2SFE0048

 

This means:

Scan all lines within the Body node for a digit (a number) in position 12. If such a digit is found, then grab 2 lines of spooled file data, and place them in the Position node.

 

Within the Position node we can now map the individual information from line 1, but we also need to add a repeat loop to pick up the extra descriptive lines and expand the main node (Position) if we find more than a single descriptive line. This can be defined like this:

 

NG2SFE0049

 

In the example above we have now told InterFormNG2 to expand the parent node (Position) to include all of the matching Notes. The notes are identified as the spooled file lines with a blank in line 9. It starts to scan in line 2 of the parent node and repeats for all detail lines, that contains a Whitespace in line 1, position 9.

 

You might wonder why the Note node is not repeated for all lines within the Body, but the reason is, that a totally blank line does not match the condition of a WhiteSpace token in position 9. A totally blank line instead matches the token, EmptyLine.


    • Related Articles

    • Splf extractor: Simple mapping

      The spooled file extractor selects data from all the pages of the spooled file. The output XML file is a file with a node for each spooled file page, so it is very each to see from which spooled file page the XML data was extracted. First you need of ...
    • Splf extractor: Conditioned mappings

      Both the line and block element can be conditioned in the spooled file extractor. To condition an element you should first select the area in the spooled file view and create a simple mapping. Now you need to enable triggers on the right in order to ...
    • Introduction to the Spooled file extractor

      IMPORTANT: The spooled file extractor is no longer supported. Any spooled file extractor definitions, that has previously been designed can still be used in the workflow, but they cannot be edited. The better alternative is to use the designer for ...
    • Splf extractor: Tokens

      In the spooled file extractor you can build conditions to conditionally select section of the spooled file. Whenever you add a condition you compare the selected text with a token. Predefined tokens InterFormNG2 is delivered with these predefined ...
    • Splf extractor: How to save

      When you created a new spooled file extractor or edited an existing one via the editor, then the save icon in the top becomes blue, which indicates, that the definition has been changed. To save the current spooled file extractor you simply click on ...