Please enable JavaScript to view this site.

InterFormNG2 Manual

Navigation: Spooled file support > Spooled file extractor

Splf extractor: Expanable parent

Scroll Prev Top Next More

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.