ng:spoolMap

ng:spoolMap

The built-in function, ng:spoolMap is only available in InterFormNG2, if you are running InterFormNG2 on the IBM i platform.

 

With this function you can map data from an input spooled file in the designer, and extract information from the spooled file e.g. to use a conditions in both the designer and the workflow.

 

An alternative to the ng:spoolMap is the ng:spoolMapCond function, that only maps spooled file lines, that fit a specific condition. You can also consider to use the ng:spoolMapRel for referring to spooled file lines x-lines below a valid condition.

 

The easiest way to use the ng:spoolMap function is to first load a spooled file, and then insert the function via the magnifying glass e.g. in the text element.

 

Here is an example of the function:

 

ng:spoolMap(//page[1], 1, 132, 1, 80, 'trim')

(This selects the spooled file data from page 1 of the input spooled file. It takes the information from position 1 to 132 of the lines from 1 to 80 and trims each line).

 

The parameters of the function, ng:spoolMap are in this sequence:

 

  1. A reference to the page, that you want to map.
  2. The start position number to map.
  3. The end position number to map.
  4. The start line to map.
  5. The end line to map.
  6. An optional trim option. If this parameter is trim, then each spooled file line is trimmed of any leading and trailing spaces. If this parameter is missing or has any other value than 'trim', then the spooled file data is not trimmed.

 

 

The first parameter is a bit special. For that you have two options:

 

1.You can refer to a specific page number. You should e.g. do that, if you e.g. to insert a condition to compare spooled file data in a specific page, positions and line. For that you select the page number like above: //page[<nbr>], where <nbr> is the page number, that you want to select.

2.You can also refer to the current page. This usage is normally only used in the designer, where you repeat the page element for all pages in the input spooled file as shown in these sections: Map spooled file data from current page and Reproduce input spooled file as output. In these examples you should map the spooled file data with Auto set as the page number in the upper right corner. If you want to type in a reference to the current number, then the page reference in the ng:spoolMap function should be ./text(), so the function: ng:spoolMap(./text(), 2, 27, 6, 11) maps position 2 to 27 of lines 6 to 11 of the current page.

 

 

Mapping only a single blank line

Special information concerning mapping of blank lines (including lines with just blanks): If this function is mapping only one single blank line, then this will not force a vertical reposition in a dynamic flow. This and the workaround/solution is covered in the section, Vertical flow for a blank text of the text element.


Refer to spooled file contents in an existing element

One way to refer to spooled file contents is e.g. in an existing text element. Here you first click Expression and then the magnifying glass to view the spooled file contents. Then you see the spooled contents as below:

 

NG2SpoolMap001

 

If this is the first time you enter this for the current parameter, then you see the trim option in the top. This is default enabled. That means, that if you now select an area with the mouse and then click OK and Apply, then the text from the spooled file is mapped, but each spooled file line is trimmed of any leading and trailing blank - if the trim option is enabled.

 

 

 

Drag spooled file contents into the result view

Another way to map spooled file data into the output (after the spooled file has been loaded in the designer) is to click this icon on the top left:

 

NG2SpoolMap002

 

Then you can with the mouse drag around an area (which will be marked with a box) and then drag that area to the result view while holding down the left <CTRL> key on the keyboard.

 

For this mapping the trim option is default enabled:

 

NG2SpoolMap003


    Notice: Help Center Transition Update

    As of January 13, 2025, we are excited to announce that our new Help Center is in the final stages of development. While the Knowledge Base is already accessible, our current JIRA system will continue to manage support tickets during this transition period. For assistance with InterForm Output Management Software, please refer to the Support for InterForm Output Management Software.

    We appreciate your patience and understanding as we work to enhance your support experience. If you have any questions or encounter any issues, please do not hesitate to reach out via the existing support channels.

    Best regards,
    The InterForm Support Team


      • Related Articles

      • ng:spoolMapCond

        IMPORTANT: This function is only supported for spooled files loaded in the old format, Version 1, which is not recommended - it is not supported for spooled files loaded in version 2, which is better, default alternative to load spooled files in. ...
      • ng:spoolMapRel

        The built-in function, ng:spoolMapRel is only available in InterFormNG2, if you are running InterFormNG2 on the IBM i platform, or have activated the AS400 option in InterFormNG2. This function only supports spooled files loaded in the version 2 ...
      • ng:resourceExist

        ng:resourceExist(resource,path) This function checks, if a resource in InterFormNG2 exists or not. The function returns a boolean: true or false. The ng:resourceExist Xpath function has this format: ng:resourceExist(resource,path), where: resource ...
      • ng:decrypt

        The built-in function, ng:decrypt is linked with the encryption functions: ng:encrypt and the workflow component, Set secure workflow variable. The function, ng:decrypt can decrypt contents, that was previously encrypted with these functions. The ...
      • ng:minimum

        InterFormNG2 includes the special built-in XPath function, ng:minimum. This function returns the smallest value of two numeric arguments. The function only accepts two numeric arguments - no more and no less. Examples: ng:minimum(-14,2) returns 2 ...