cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Add a select all searchbox that triggers Oncheck

I would like to have a Select all check box in connection with my gallery.

At the moment I have a checkbox in the gallery (named: CB-gallery) and a checkbox outside the gallery to fill the purpose of select all (named: CB-checkall). 
I can change the default of CB-gallery to CB-checkall.Value  and visually the checkboxes in the gallery will change but it won't trigger the actions I need.

Here are the properties of CB-gallery:
OnCheck:        Patch(col_patchAllnewappro, ThisItem, {IsChosen1:true})
OnUncheck:    Patch(col_patchAllnewappro, ThisItem, {IsChosen1:false})
Default:           ThisItem.IsChosen1

And I have a button to patch the selected items:
OnSelect: ForAll(RenameColumns(Filter(col_patchAllnewappro,IsChosen1),"ID","EID"),Patch('Quality evaluator',LookUp('Qualityevaluator',ID = EID),{'Team lead': btn_choose_TL.Selected},{'Status approval request': "Pending"}));Notify (
"All selected agents have been re-assigned a new Team Lead",Success,4000);Reset ('btn-choose-tl')

Long story short, I want that when I click on my select all button, not only my galleries checkboxes are ticked but also that I can trigger the Oncheck and OnUncheck in addition to what I already have that is to do it to selected employees.

Can you help?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Anonymous 

Please consider changing your button Formula to the following:

Patch('Quality evaluator',
    ForAll(Filter(yourGallery.AllItems, CB-gallery.Value) As _item,
        {ID: _item.ID,
         'Team lead': btn_choose_TL.Selected,
         'Status approval request': "Pending"
        }
    )
);
Notify ("All selected agents have been re-assigned a new Team Lead",Success,4000);
Reset ('btn-choose-tl')

 

Change the Default of the checkbox to: cB-checkall.Value

 

Get rid of all the OnCheck and OnUncheck and collections, you don't need any of this for what you are trying to do.

Just substitute the appropriate names in the formula above to match your control names in your app.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

8 REPLIES 8
RandyHayes
Super User
Super User

@Anonymous 

Please consider changing your button Formula to the following:

Patch('Quality evaluator',
    ForAll(Filter(yourGallery.AllItems, CB-gallery.Value) As _item,
        {ID: _item.ID,
         'Team lead': btn_choose_TL.Selected,
         'Status approval request': "Pending"
        }
    )
);
Notify ("All selected agents have been re-assigned a new Team Lead",Success,4000);
Reset ('btn-choose-tl')

 

Change the Default of the checkbox to: cB-checkall.Value

 

Get rid of all the OnCheck and OnUncheck and collections, you don't need any of this for what you are trying to do.

Just substitute the appropriate names in the formula above to match your control names in your app.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Hi @RandyHayes,
Thank you for your reply.

The thing is, I want to be able to Patch all item as well as specific selected ones, that's why I have the collection and Check and Uncheck triggers. So changing the button would not solve the whole problem.

RandyHayes
Super User
Super User

@Anonymous 

Can you elaborate on what you mean?  The formula you originally posted had no other factors other than what the method you had of putting checked isChosen boolean values in a collection and then you Filtered by that condition - so what else were you expecting that the provided suggestion does not solve?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

@RandyHayes 
At the moment, the process is:
I choose a manager with the help of a ComboBox and then in my gallery I choose which employees will be assigned to that manager. The checkboxes now are my indicator of which specific items I should update.
I still want to be able to do it. Plus to do the same action with all employees in the gallery when selecting all.

I hope it's clear

RandyHayes
Super User
Super User

@Anonymous 
Yes...the formula I provided will do exactly that...change records in your list based on the checkbox checked.

Your items in the gallery will be based on your combobox.  So it will only have the items based on that condition.

If you click select all, all of the checkboxes in your Gallery (again, based on the filter) will become checked.  If you do single selections of the checkboxes then you'll have some checked and some not.

 

When you press the button, it will filter all the rows in the gallery that have the checkbox checked and will patch them back to your list with the change you want made.

This part of the formula does that:  Filter(yourGallery.AllItems, CB-gallery.Value)

That returns a table of all of the gallery items that have the checkbox checked.

It then patches the record back to the item that matches that ID in your list:

{ ID: _item.ID,  this is needed to match the record  
'Team lead': btn_choose_TL.Selected,   This will update the Team lead column
'Status approval request': "Pending"  This will change the status to pending
}

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

@RandyHayes 

Alright, thank you for clarifying it. I'm still new to this.

RandyHayes
Super User
Super User

@Anonymous 

No worries.  Just keep in mind that all of your controls in your app are globally accessible in the app. 

They contain information that you can leverage without variables and collections (which quite honestly completely overcomplicate, confuse and frustrate most people starting out - and they're usually not needed).  There are places for all those things, but not when you already have what you need.

A collection is a Table that YOU must maintain (adding, removing, changing etc.)  A Gallery is a Table that changes dynamically based on interaction with it (in this case checkboxes) and its filter of the Items.

SO...it is a Table that you DON'T have to maintain like a collection.  It has what you need.

You can filter it, shape it and more without ever needing anything else. 

In this case, we filtered the Table based on the checkboxes (which all become, along with everything else you put in the gallery, part of the record of the gallery table).   From that, we did a Patch statement and gave it a table of records to patch (we used the ForAll to give us a table to patch back...which is what it does- makes tables).

That table that was made in the ForAll has three columns in it, the ID (needed to match a record in your list), the team lead column and the status column. 

 

So...at the end of it all we basically did a Patch with a table of three columns that had as many rows as were checked from the gallery.

 

Hopefully that is clear and helpful. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

@RandyHayes this worked greeeeeat for the patching. Thank you so much.
I'm having troubles now with my Delete button. Previously I was using the collection to look up my selected items and remove them.
Is that a way to use your suggestion to delete items selected by my check all box?

Thanks again

Helpful resources

Announcements

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!      

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Tuesday Tip | How to Get Community Support

It's time for another Tuesday Tip, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.       This Week: All About Community Support Whether you're a seasoned community veteran or just getting started, you may need a bit of help from time to time! If you need to share feedback with the Community Engagement team about the community or are looking for ways we can assist you with user groups, events, or something else, Community Support is the place to start.   Community Support is part of every one of our communities, accessible to all our community members.   Within each community's Community Support page, you'll find three distinct areas, each with a different focus to help you when you need support from us most. Power Apps: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pa_community_support Power Automate: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpa_community_support Power Pages: https://powerusers.microsoft.com/t5/Community-Support/ct-p/mpp_community_support Copilot Studio: https://powerusers.microsoft.com/t5/Community-Support/ct-p/pva_community-support   Community Support Form If you need more assistance, you can reach out to the Community Team via the Community support form. Choose the type of support you require and fill in the form accordingly. We will respond to you promptly.    Thank you for being an active part of our community. Your contributions make a difference!   Best Regards, The Community Management Team

Community Roundup: A Look Back at Our Last 10 Tuesday Tips

As we continue to grow and learn together, it's important to reflect on the valuable insights we've shared. For today's #TuesdayTip, we're excited to take a moment to look back at the last 10 tips we've shared in case you missed any or want to revisit them. Thanks for your incredible support for this series--we're so glad it was able to help so many of you navigate your community experience!   Getting Started in the Community An overview of everything you need to know about navigating the community on one page!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Ranks and YOU Have you ever wondered how your fellow community members ascend the ranks within our community? We explain everything about ranks and how to achieve points so you can climb up in the rankings! Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Powering Up Your Community Profile Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile. Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Community Blogs--A Great Place to Start There's so much you'll discover in the Community Blogs, and we hope you'll check them out today!  Community Links: ○ Power Apps ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Unlocking Community Achievements and Earning Badges Across the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. Check out some details on Community badges--and find out more in the detailed link at the end of the article! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio    Blogging in the Community Interested in blogging? Everything you need to know on writing blogs in our four communities! Get started blogging across the Power Platform communities today! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Subscriptions & Notifications We don't want you to miss a thing in the community! Read all about how to subscribe to sections of our forums and how to setup your notifications! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Getting Started with Private Messages & Macros Do you want to enhance your communication in the Community and streamline your interactions? One of the best ways to do this is to ensure you are using Private Messaging--and the ever-handy macros that are available to you as a Community member! Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Community User Groups Learn everything about being part of, starting, or leading a User Group in the Power Platform Community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Update Your Community Profile Today! Keep your community profile up to date which is essential for staying connected and engaged with the community. Community Links: ○ Power Apps  ○ Power Automate  ○ Power Pages  ○ Copilot Studio   Thank you for being an integral part of our journey.   Here's to many more Tuesday Tips as we pave the way for a brighter, more connected future! As always, watch the News & Announcements for the next set of tips, coming soon!

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Top Solution Authors
Top Kudoed Authors
Users online (4,542)