Please enable JavaScript to view this site.

InterFormNG2 Manual

The function, ng:varToString('varName','encoding') is a function, that has been added especially for use with web service. The function converts the variable, varName (which is expected to be an integer) into a string.

 

This encodes the variable, hello as an UTF-8 string

ng:varToString('hello', 'utf-8')

 

Both variable name and encoding are xpath expressions.

 

Please note that this is a magic variable and it might have some limitations if used layered ( e.g. ng:varToString(ng:varToString('hello','utf-8'),'iso-8859-1') ).

 

A related function is ng:payloadToString().

 

This built-in function was added as an aid for those, that wants to call external Http(s) rest apis. If the api expects a string, then this function can be used to convert a variable (with binary contents) into a string. An example for how this can be used is included here.