Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Re-using apply to each data for later condition

(0) ShareShare
ReportReport
Posted on by 76

Hi, i have flow that does the following: Create .csv files on a FTP server folder (for example test.csv gets created in the FTP input folder). A different software program does something to the file and converts it to a .zip, then places it in a output folder on the FTP server (for example test.zip gets created in the FTP output folder.

 

Now this works great, but i want to build in a extra check. In case a output file does not get created in the output folder on the FTP, i want to recieve a email. I see there is a flow step called 'list files in FTP folder', my plan was to do the following:

 

1.  Let the flow create the .csv in the Input folder

2. Wait a minute

3. Use listfiles to list all the names of the files present in the output folder

4. Use a condition to check wether the names of the newly created files match with the names in the output folder (in that case im sure there are none missing)

 

Kryptic_0-1600083227082.png

 

 

 

Problems:

- I don't fully understand how to re-use the names of the earlier created files, theyre in a 'apply to each' loop and i can't get them out to use in the main steps.

- I don't exactly know how to build in the condition for this.

 

Detail view of 'CREATE .CSV IN FTP':

 

Kryptic_1-1600083413988.png

 

Help is appreciated

 

 

  • Kryptic Profile Picture
    76 on at
    Re: Re-using apply to each data for later condition

    UPDATED:

     

    I managed to use 'append to string variable' to get the filename each time it goes through the loop. I also put them in an array but im not sure if this is necessary?

     

    I delay for a minute, then i retrieve the filenames list. What i need to do now is:

     

    For each loop variable 'created file name' i need to check if its listed in the 'List files in output folder step', how can i best do this?

     

    Kryptic_0-1600249763120.png

     

  • Kryptic Profile Picture
    76 on at
    Re: Re-using apply to each data for later condition

    Yes i'm looking for something like what you're describing. I tried to implement the solution into my flow but i don't fully understand how to go about this..... Do you have example of where i should put these variable string array blocks?

  • Verified answer
    psycrkz1 Profile Picture
    on at
    Re: Re-using apply to each data for later condition

    You can always use a variable to store the file name in the apply to each loop with a string array that appended with a separator in each loop.

     

    Then out of this for each loop, you will be able to get the string array as the file names that created for further use  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1