# Can I perform an action based on whether a file has data?

Yes, you can perform workflow actions based on the decision whether a file has data or not. This can be done using an Aggregate object in a dataflow to calculate record count and pass it as an output variable in the workflow. &#x20;

Dataflow:

<figure><img src="/files/AtRSDGFzs7OZ6oFPT8DV" alt=""><figcaption></figcaption></figure>

Workflow:

<figure><img src="/files/7mq7qnIVpmpFVaKBAu4o" alt=""><figcaption></figcaption></figure>

The following steps allow you to perform workflow actions based on whether a file has records or not:&#x20;

* In the dataflow, map a source field to an Aggregate transformation, setting the aggregate function for that field to Count.&#x20;
* Then, map that field from the Aggregate transformation to an Expression where you would set this field to a variable.&#x20;
* Define an output variable for this field in a local variables object. &#x20;
* In your workflow, configure a Run Dataflow Task for your dataflow, the output variable will appear in the object. &#x20;
* Place a Decision task after the Run Dataflow task. &#x20;
* Specify the condition that Count variable should be greater than 0. &#x20;
* Map the Yes port to the task that should be performed if the file has records. &#x20;
* Map the No port to the task that should be performed if the file does not have records. Either of these ports can be left unmapped if you don’t want a task to be performed for that decision outcome. &#x20;

> Note: This process might impact performance when handling large datasets. Although we only need to determine if there are any records (0 or more), the system will process the entire dataset.&#x20;


---

# 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://documentation.astera.com/faqs/workflows/can-i-perform-an-action-based-on-whether-a-file-has-data.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.
