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

# Formatters

> Overview of ArcScript value formatters for modifying and formatting data within scripts and expression settings.

export const siteNameShort = "Arc";

Formatters support modifying or formatting values within a script or expression setting and operate by accepting input and producing output. Input is passed into formatters in the form of an attribute on an item or as a [Function](./function-formatters).

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

* [String](./string-formatters)
* [Array](./array-string-formatters)
* [Date](./date-formatters)
* [Number](./number-formatters)
* [File](./file-formatters)

Functions, while used in the same way as formatters, produce output but do not require explicit input. See [Functions](./function-formatters) for details.

## 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. Multiple formatters can be used by delimiting each formatter with a vertical pipe; the formatters will be 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 snippet any "\*" character in the `myid` attribute's value is replaced by "-", and the resulting value is assigned to `input1.id`.

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

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

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

* The total cost for a purchase order line item may need to be calculated by multiplying the item quantity with the price-per-item.

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