> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sync.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Formatters

*Formatters* support modifying or formatting values within a script. You can use value formatters to perform string, date, and math operations on values.

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

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

In this line, *formatter* specifies the name of the formatter and *parameters* is an optional set of parameters to control formatter output. You can use multiple formatters by delimiting each formatter with a vertical pipe ("|"). The list of formatters are evaluated from left to right, and the output from one formatter will be piped into the next formatter.

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

## Examples

* In the following code snippet, any asterisk character (`*`) in the `myid` attribute's value is replaced by `-`. The resulting value is assigned to `input1.id`.

  ```xml theme={null}
  <api:set attr="input1.id" value="[myid | replace('*', '-')]"/>
  ```

* In the following example, two value formatters are chained with the pipe (`|`) character. In the example, only .log files are pushed from the operation.

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

* The total cost for a purchase-order line item might need to be calculated by multiplying the item quantity with the price per item, as shown below:

  ```xml theme={null}
  <api:set attr="cost" value="[itemQuantity | multiply([itemPrice])]" />
  ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.