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 / Checkbox is patching u...
Power Apps
Answered

Checkbox is patching unchecked records

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

This is my patch statement which is on a button. Currently every record is being patched whether checked(true) or unchecked (false). Is there a way to only patch the checked records?

 

Navigate(Screen2,Fade);ForAll(BrowseGallery1.AllItems, Patch('CCB Voting', Defaults('CCB Voting'), {Title:Name, Answer: Checkbox3.Value,Name_:User().FullName, Date:Today(), Country:(First(Office365Users.SearchUser({searchTerm:User().Email}).Country).Country)}))

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Consider changing your formula to the following:

     

    Navigate(Screen2, Fade);
    ForAll(
     Filter(BrowseGallery1.AllItems, Checkbox3.Value), 
     Patch('CCB Voting', 
     Defaults('CCB Voting'), 
     {Title:Name, 
     Answer: Checkbox3.Value,
     Name_:User().FullName, 
     Date:Today(), 
     Country: Office365Users.UserProfileV2(User().Email).country
     }
     )
     )

     

    That should give you what you are looking for.  Also, with the bonus of simplifying the country lookup.

     

    I hope this is helpful for you.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    Also add to the last post.  You will want to do the User() function once if you can.  The function has a hit on performance.

    Consider this formula instead of the one I mentioned last.

    Navigate(Screen2, Fade);
    With({UserEmail: User().Email, UserName: USer().FullName},
    
     ForAll(
     Filter(BrowseGallery1.AllItems, Checkbox3.Value), 
     Patch('CCB Voting', 
     Defaults('CCB Voting'), 
     {Title:Name, 
     Answer: Checkbox3.Value,
     Name_:UserName, 
     Date:Today(), 
     Country: Office365Users.UserProfileV2(UserEmail).country
     }
     )
     )
    )

    This will do only two calls to the user function instead of two for each record you are patching.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Works perfectly!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard