© Copyright 2023, Astera Software
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.
Dataflow:
Workflow:
The following steps allow you to perform workflow actions based on whether a file has records or not:
In the dataflow, map a source field to an Aggregate transformation, setting the aggregate function for that field to Count.
Then, map that field from the Aggregate transformation to an Expression where you would set this field to a variable.
Define an output variable for this field in a local variables object.
In your workflow, configure a Run Dataflow Task for your dataflow, the output variable will appear in the object.
Place a Decision task after the Run Dataflow task.
Specify the condition that Count variable should be greater than 0.
Map the Yes port to the task that should be performed if the file has records.
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.
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.