Skip to main content
Community site session details
Power Apps - Building Power Apps
Answered

How to break out of ForAll loop based on a If condition?

Like (0) ShareShare
ReportReport
Posted on 27 Aug 2020 07:33:47 by

Hi All,

 

I wanted to understand how to break out of ForAll loop in powerapps based on a If condition.

 

Below is the code used for my ForAll loop. According to the below code, I am setting variable dupleave to false initially and the moment it turns to true inside ForAll, it should break out of both the loops.

 

-----------------------------------------------------

 

UpdateContext({dupleav: false});

ForAll(ourCollection, (ForAll(ourCollection1, If(LeaveDates = AppliedDates, dupleav = true, dupleav = false))))

 

-----------------------------------------------------

 

Thanks,

 

Vishwas.

  • Verified answer
    Community Power Platform Member Profile Picture
    on 30 Aug 2020 at 11:14:12
    Re: How to break out of ForAll loop based on a If condition?

    Hi Again,

     

    Finally I was able to achieve what I wanted to.

     

    The button was disabled during OnSelect event of date picker by setting the value of global variable to displaymode (edit or disabled based on condition). Now, assigned the global variable to displaymode of the button and it is working as expected.

     

    Thanks for all the help and inputs!!

     

    Vishwas.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473