Value Formatters

Version 23.0.9145


Value Formatters


Value formatters enable you to generate new values with specific formatting. They operate by accepting input and producing output. Input is passed into formatters in the form of an attribute on an item.

The formatters defined in this section are categorized based on the type of input they accept:

Formatter Basics

Attributes (variables) are passed into formatters using vertical pipe characters: |

[item.attribute | formatter(parameters)]

where formatter is the name of the formatter and parameters is an optional set of parameters to control formatter output. Use multiple formatters by delimiting each formatter with a vertical pipe: the formatters are evaluated from left to right and the output from one formatter is piped into the next formatter:

[item.attribute | formatter(parameters)] | formatter(parameters) | ...]

Examples

  • In the following snippet any * character in the myid attribute value is replaced by -, and the resulting value is assigned to input1.id.

      <api:set attr="input1.id" value="[myid | replace('*', '-')]"/>
    
  • Here, two value formatters are chained with the pipe (|) character. In this example, only .log files are pushed from the operation.

      <api:call op="fileListDir">
        <api:check attr="name" value="[filename|tolower | endswith('.log')]">
          <api:push/>
        </api:check>
      </api:call>