Forum Discussion

tdoolittle's avatar
tdoolittle
Frequent Visitor
3 years ago
Solved

Power Automate 'Export To File for Paginated Reports' Stop if Output is Empty

Hi,

I've spent a long time browsing various forums and use cases but I can't seem to find a solution for something that seems simple. Here are the steps of my cloud flow:

  1. Recurrence (output on a schedule)
  2. Export To File for Paginated Reports (create the output in PDF format)
  3. Create blob (V2) (drop the PDF file in an Azure blob endpoint)

Before step 3 occurs, I'm trying to find a way to check that the file that was created contains data, based on the underlying query that is executed in Power BI Report Builder. It seems there might be a solution to try to drop it in SharePoint first, then get the metadata to check the file size, if it's above a certain amount then move to the create blob step, and delete the temporary SharePoint file. But that seems ridiculous since the output is being stored within the flow before being saved to the blob, there surely should be some way to check the metadata of step 2 to determine if the output is going to be blank, and if so abandon the rest of the flow? Thanks!

  • After much searching and testing, I found a solution that works for me. Even though the steps appear to go in a certain order, the [Export To File for Paginate Reports] does not appear to hold the file temporarily somewhere, it directly exports into the target location.

     

    The solution was to add steps after [Create blob (V2)] which do the following:

    • Under [Azure Blob Storage], [List blobs (V2)] at the [Create blob (V2)] location, which retrieves the metadata of all items
    • Under [Control], [Apply to each], which will create a for each loop on the result set of the [List blobs (V2)] step
    • Under [Control], [Condition], take the [Size] attribute from the [List blobs (V2)] step and check that it's less than the minimum file size in bytes
      • If true, then use [Azure Blob Storage], [Delete blob (V2)] and pass the [Id] attribute from the [List blobs (V2)] step
      • If false, then do nothing

1 Reply

  • tdoolittle's avatar
    tdoolittle
    Frequent Visitor

    After much searching and testing, I found a solution that works for me. Even though the steps appear to go in a certain order, the [Export To File for Paginate Reports] does not appear to hold the file temporarily somewhere, it directly exports into the target location.

     

    The solution was to add steps after [Create blob (V2)] which do the following:

    • Under [Azure Blob Storage], [List blobs (V2)] at the [Create blob (V2)] location, which retrieves the metadata of all items
    • Under [Control], [Apply to each], which will create a for each loop on the result set of the [List blobs (V2)] step
    • Under [Control], [Condition], take the [Size] attribute from the [List blobs (V2)] step and check that it's less than the minimum file size in bytes
      • If true, then use [Azure Blob Storage], [Delete blob (V2)] and pass the [Id] attribute from the [List blobs (V2)] step
      • If false, then do nothing