Built-in functions

Built-in functions

InterFormNG2 comes with multiple built-in XPath functions. The built-in functions can be used XPath expression in both the designer and in the workflow.

 

While editing an XPath expression you can click the icon looking like a magnifying glass:

 

NG2BuiltInFunctions0001

 

- and then you will see this:

 

NG2BuiltInFunctions0002

 

If you now click Built-in functions on the right, then you can see the list of the built-in XPath functions, that you can use freely in InterFormNG2:

(All are described in the sections below).

 

1.ng:base64 Converts a string into Base64 encoded string.

2.ng:base64EncodeFile. Returns the converted contents of a file into a Base64 encoded string.

3.ng:base64EncodeResource Returns the result of a conversion of the contents of a Library resource into a Base64 encoded string.

4.ng:databaseLookup. This makes it possible to run an SQL lookup anywhere in InterFormNG2 - including the designer.

5.ng:compare. This can be used for comparing two texts or numbers.This often is a better tool than a simple compare with <>!=, as a comparison with e.g. null can give another result than expected like described in the sections: Verify if a node existsTest if a node is not blank and Test if a node is blank.

6.ng:dateFormat Converts almost any date format into anothe date format.

7.ng:dateTimeFormat Converts a timestamp (date and time) into the format of your choice.

8.ng:fileExist Verifies if a file exists. A related function is ng:resourceExist.

9.ng:hexToUtf8 Converts a sequence of hex characters into the equivalent UTF-8 characters.

10. ng:last-page-number Returns the total number of pages of the current output inside a template, when you edit it in the designer.
11. ng:measureFont. This function can calculate the width of a text when the font, font size and bold/italic options are known. This can be used to adapt the font size to the dynamic width of a text.
12. ng:minimum Return the smallest number of two numeric parameters.
13. ng:numberFormat Formats an input number into the format of your choice.
14. ng:page-number The current page number in a template. This can be used in the designer inside of a template.
15. ng:resourceExist Verifies if a resource exists. The function returns true or false. Related function is ng:fileExist.
16. ng:serializationData. Inserts a counter with a user defined increment in the ZPL output only.
17. ng:spellOutNumber Option to output a number spelled out in a selected language. This can e.g. be used in cheques to spell out the amount.
18. ng:spoolMap A function to extract spooled file date in both the designer, in the workflow and in for Spooled file enrichment via SQL.
19. ng:spoolMapCond. This function is for version 1 spooled files only thus it should not be used.
20. ng:spoolMapRel. This function is used for references to relative spooled file lines within a line-repeat.
21. ng:translation A function to do language dependent translations with a key.
22. ng:trim Trims the leading and trailing spaces of a string - normally a better alternative to the standard XPath function, normalize-space().
23. ng:trimLeft Trims leading spaces of a string.
24. ng:trimRight Trims trailing spaces of a string.
25. ng:varToString The function converts a variable (which is expected to be an integer) into a string. The function has been added especially for use with a web service.
26.ng:uuid() This function generates a 128-bit universally unique identifier that complies with the Internet Engineering Task Force RFC 4122 standard.

 


    • Related Articles

    • Spooled file extract functions

      This section lists and describes the functions available to extract information from the spooled file. Normally you do not need to think much about this as the functions are normally added when you select an area in the input spooled file, so you do ...
    • ng:page-number

      This section explains the built-in XPath function: ng:page-number() This function outputs the current page number of the output. The function has no parameters. You can use this function with other functions in an XPath expression - unlike the ...
    • 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:base64

      The built-in function, ng:base64 converts a string (text) into a base64 based string. This can e.g. be used, if you want to insert any kind of data into an XML node, without substituting any characters, that are not allowed. This function is related ...
    • ng:base64ToUTF8

      The built-in function, ng:base64ToUTF8 converts a base64 encoded string (text) into a UTF8 based string. This can e.g. be used, if you want to extract the original UTF-8 encoded text from a base64 encoded node found in an input XML input file. If the ...