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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can I create a loop in...
Power Apps
Answered

Can I create a loop in PA?

(0) ShareShare
ReportReport
Posted on by 87

Hello Friends, 
I have this code where I'm trying to say: if an Apple Status is Eaten make all the Apple Seed = Eaten 

Every Apple has many seeds.

This code only changes the first seed's status in a list to eaten but I want the whole list to be = to eaten

 

Can I create a loop in PA for it to keep running the code so the whole list's statuses get affected?

 

Here is the code

Patch(

ApplesSeeds,

LookUp(AppleSeeds,AppleSeeds_Apple.AppleID= AppleIDDataCardValue.Text

),

{

AppleSeedStatus: LookUp(Choices(Status), Text(Value) = "Eaten",Value)

}

);

FYI data source for this is dataverse 

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,565 Super User 2026 Season 1 on at

    Hi @PowerAppsRookie ,

     

    You may want to look into using the UpdateIf() function: https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-update-updateif

  • mmollet Profile Picture
    3,187 on at

    I would def do what @BCBuizer said but just to answer your question about loops in powerapps. There is a ForAll statement which is as close to a loop as we get I believe. It will essentially loop through all the rows in a table/array that you pass to it. You can filter and sort an array inline and pass the result of that into a ForAll and then have it execute code on each of them. 

     

    Here is the documentation from MSFT for the ForAll function

  • PowerAppsRookie Profile Picture
    87 on at

    Was the perfect solution! Thank you 😄

     

  • PowerAppsRookie Profile Picture
    87 on at

    Thank you! Super useful 🙂

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 103

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
wolenberg_ Profile Picture

wolenberg_ 67 Super User 2026 Season 1

Last 30 days Overall leaderboard