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

# Filter by transformer result

> Filters items by applying a transformer and comparing the result.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Decides whether to keep an item by comparing a value from the item against a value produced by a transformer. This is useful when the value you want to compare against is not fixed text but something you have to build or look up first, such as the set of allowed codes produced by a transformer. The transformer produces a reference result, then a value from the item is compared against a value from that result, and the item is kept only when the comparison succeeds.

This documentation describes: [Schema](/schemas/filter/transformer-filter)

## Fields

<FormField property="transformer" label="Data transformer" required diType="transformer">
  The transformer that produces the reference data to compare against. By default it runs once with no input, so it suits transformers that build a fixed list or lookup value. Turn on "Use entity data in transformer" below if you instead want it to work on the current item.
</FormField>

<FormField property="comparator" label="Comparator" required diType="comparator">
  How the two values are compared, for example "equals", "is one of", or "contains". The item is kept when the comparison is true.
</FormField>

<FormField property="path" label="Entity Path" required>
  An expression pointing at the value from the current item to compare, for example `status` or `customer.email`.
</FormField>

<FormField property="search" label="Search Pattern" required>
  An expression pointing at the value to read from the transformer's result, which becomes the other side of the comparison. For example, if the transformer produces `{ "allowed": "paid" }`, use `allowed` to compare against that value.
</FormField>

<FormField property="useEntityData" label="Use entity data in transformer.">
  Leave this off (the default) to run the transformer once with no input, which suits transformers that build a fixed reference value. Turn it on to feed the current item into the transformer, so the comparison value is calculated from that item.
</FormField>

## Sample data

This filter answers yes or no for each item, so there is no before and after. The example runs a transformer that produces `{ "allowed": "paid" }`, then compares each item's `status` against that `allowed` value with "equals", so only paid items are kept.

| Field                          | Value                    |
| ------------------------------ | ------------------------ |
| Data transformer               | Sets `allowed` to `paid` |
| Comparator                     | `equals`                 |
| Entity Path                    | `status`                 |
| Search Pattern                 | `allowed`                |
| Use entity data in transformer | off                      |

| Incoming item             | Result         |
| ------------------------- | -------------- |
| `{ "status": "paid" }`    | matches        |
| `{ "status": "pending" }` | does not match |

```json Configuration theme={null}
{
  "prototype": "transformer-filter",
  "parameters": {
    "transformer": {
      "prototype": "value-setter",
      "parameters": { "configurations": [ { "key": "allowed", "value": "paid" } ] }
    },
    "comparator": "equals",
    "path": "status",
    "search": "allowed",
    "useEntityData": false
  }
}
```
