How to properly access data from a previous "Read Data" operation within a "Condition" step in a Flow?

Hi everyone,

I’m trying to set up a Condition operation in a Directus Flow. My goal is to check a value from the result of a previous “Read Data” operation.

Here’s the scenario:

  1. I have a “Read Data” operation (let’s call its Operation Key get_goods_item_data).
  2. This operation returns an array of objects, like this:
[
  {
    "id": 45120,
    "sort": null,
    "user_created": "2e818224-7e3f-4b63-a65d-3672a83379a6",
    "date_created": "2025-07-05T05:14:23.700Z",
    "user_updated": "2e818224-7e3f-4b63-a65d-3672a83379a6",
    "date_updated": "2025-07-08T15:00:15.962Z",
    "article": "117662059012",
    "catalog_id": 4223,
    "selling_price": "12054",
    "price_rrp": "9220",
    "supplier_price": "7678",
    "ozon_id": "2152960947", // This is the field I want to check
    "shinservice_order_goods": [],
    "goods_stock": [
      64663,
      64664,
      64665
    ]
  }
]```

In the subsequent "Condition" operation, I want to check if the ozon_id field of the first item in this array is not null and not an empty string.

I've tried using rules like these:

{
“get_goods_item_data”: {
“0”: {
“ozon_id”: {
“_nnull”: true,
“_neq”: “”
}
}
}
}```

And even with _nempty:

{
  "get_goods_item_data": {
    "0": {
      "ozon_id": {
        "_nnull": true,
        "_neq": ""
      }
    },
    "_nempty": true
  }
}

Both of these result in the error: "Validation failed for field \"get_goods_item_data\". Value is required."

What is the correct way to reference the get_goods_item_data result (which is an array) and then check a specific field (ozon_id) within its first element (0)? Am I using the correct path to access the operation’s output?

Any guidance would be greatly appreciated! Thanks!

Hey, I believe there are two key limitations of the condition block in flows, the first is that it doesn’t handle arrays and the second is it doesn’t handle dynamic data beyond the $trigger and $last variables. See older github discussion here: Syntax for Conditions by Flows · directus/directus · Discussion #15568 · GitHub. Think most people use a read script block to calculate the conditions you are looking for and then returning a true/false flag to action a condition block on.

You can use a custom script instead of a conditional operation. Then throw an error in the custom script to send the flow down the ‘negative’ path.