# find\_exp

Finds the first item in an array that matches a Liquid expression. Unlike `find`, which compares a property to a value, `find_exp` lets you write arbitrary conditions using the full Liquid expression syntax.

```liquid
{% assign expensive = products | find_exp: "product", "product.price > 100" %}
{% log expensive.title %}
```

#### Syntax

```liquid
{{ array | find_exp: item_name, expression }}
```

| Parameter    | Description                                              |
| ------------ | -------------------------------------------------------- |
| `array`      | Array of objects to search                               |
| `item_name`  | Variable name for the current item inside the expression |
| `expression` | Liquid expression that evaluates to truthy/falsy         |

#### Return Value

Returns the first item for which the expression evaluates to a truthy value, or `null` if no item matches.

#### Examples

**Find first product above a price threshold:**

```liquid
{% assign expensive = products | find_exp: "p", "p.price > 50" %}
{% if expensive %}
  {% log "First expensive product: " | append: expensive.title %}
{% endif %}
```

**Find first order with a specific tag:**

```liquid
{% assign vip_order = orders | find_exp: "order", "order.tags contains 'VIP'" %}
{% log vip_order.name %}
```

**Find first out-of-stock variant:**

```liquid
{% assign out_of_stock = variants | find_exp: "v", "v.inventory_quantity <= 0" %}
{% if out_of_stock %}
  {% log "Out of stock: " | append: out_of_stock.sku %}
{% endif %}
```

**Find first item matching multiple conditions:**

```liquid
{% assign match = products | find_exp: "p", "p.vendor == 'Nike' and p.product_type == 'Shoes'" %}
{% if match %}
  {% log match.title %}
{% endif %}
```

#### Notes

* The `item_name` parameter defines how you reference each item inside the expression
* The expression supports all Liquid operators: `==`, `!=`, `>`, `<`, `>=`, `<=`, `contains`, `and`, `or`
* Returns the **first** matching item only
* For simple property-to-value comparisons, `find` is more concise
* See also: `where_exp` (returns all matching items, not just the first)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datajet-app.com/liquid/filters/find_exp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
