web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Condition length share...
Power Automate
Unanswered

Condition length sharepoint file > 0 in apply to each each will not evaluate to false

(0) ShareShare
ReportReport
Posted on by 688
Hi,
I have a flow that from powerapps gets a collection of filenames of files that in principle exist in a sharepoint document library.
Primary this flow needs to use these files as attachments in an email.
 
I do this by using steps
 
-V2 powerapps connector
-Initialize array variable
-parse json from powerapps
-apply to each
    -get files (properties only)
    -condition:
    length(outputs('Get_files_(properties_only)')?['body/value'])>0
  -get file content using path
  -append to array
-send email (using array for attachments)
 
The condition step is important, without it the whole flow fails if one filename is invalid.
It all works fine, but now I would like to have the flow return the invalid filenames to powerapps.
I thought it would be simple, just initialize another array and append filenames to that if the condition step returns false
 
If I test the flow using 2 filenames, one valid and one invalid, a mail is send with the valid file but the "false" branch is never used as 
"The execution of template action 'For_each' skipped: the branching condition for this action is not satisfied."
 
How can this be? The condition is either true or false. 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    68,678 Most Valuable Professional on at
    Condition length sharepoint file > 0 in apply to each each will not evaluate to false
    The point of that condition is to test the length of the array of files that is returned. If it doesn't find the file then the length of the array will be 0 because the array is empty. If the array is empty then there are no items in the array for the apply to each to loop through.  If you are feeding in filenames and using the Get files to see if the files exist then if the condition is zero send those filenames back. But there is no way to get that information out of the array returned by the get files.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • HansHeintz Profile Picture
    688 on at
    Condition length sharepoint file > 0 in apply to each each will not evaluate to false
    @Pstork1 
    But I do get files within apply to each after parse json. So get files is evaluated for each filename and then the condition is evaluated for each filename. I can append to an array if condition is met (true) so why can't I append to another array if condition is not met (false)?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard