# extract

Source: https://zotonic.com/docs/2498/extract

URI: https://zotonic.com/id/2498

Language: en



Extract a specific property from each item in a list.

This filter extracts a named property from maps, proplists, or resources in a list, returning a new list containing only those values.

For example:

```django
    {{ items | extract:"price" }}
```

When `items` is a list like `[#{price => 10, name => "A"}, #{price => 20, name => "B"}], this returns`\[10, 20\]\`.

This is particularly useful when combined with the sum filter for analytics:

```django
    {{ orders | extract:"amount" | sum }}
```

When extracting from resources, you can use any valid resource property:

```django
    {{ m.search[{query cat="product"}] | extract:"title" }}
```

If applied to a single item instead of a list, it extracts and returns the property value from that item.

If the input is `undefined`, the filter returns an empty list `[]`.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2498?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2498?language=en>)
