cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jsunnb
Helper I
Helper I

Best way to Patch and Display results

Hello all, I have a question that I've toyed around with in my mind and was trying to figure out if its the right way to do things or not.

 

So I'll attach a screenshot, sadly, a lot is redacted so I don't share anything sensitive, but I think it'll get my point across anyways.

Picture1.png

 This is a small part of my app I've been making and updating for over a year now. For the most part it does everything that I want it to do, its just very very slow. My backend is a SQL server View. When there are only a few lines, it runs decent enough, but if I have a lot of lines, like over 20ish, it tends to be a bit sluggish. 

Currently, today, this gallery that has all the lines is loading directly from the SQL View. When I use the green check or red x to approve or reject that line, it preforms a patch on the table that holds the data and then refreshes the view so that this gallery will reflect the changes. But that is where it is so slow. I've heard about using collections but never been brave enough to put in the effort to try it. But basically, I wanted to describe the change I'm wanting to make and get feedback if that is how I should be doing it, or if I should stick with what I have now.

So what I'm wondering is if I should be loading that entire view into a collection, and then have the gallery load from the collection. And when I need to do a patch, I would still patch the table, but I would also patch the collection so it reflects the change. I'm thinking that patch on the collection triggers the refresh of the gallery, and then I don't have the app waiting for the view to refresh meaning it would be faster. At least that is my theory. Am I on the right path, or should I be going a completely different direction?

4 REPLIES 4
Ethan_R
Super User
Super User

Hi @Jsunnb ,

 

Using collection is considerably faster compared to one-by-one approach.

The only thing is I have seen, bulk update works very fast on SharePoint records. I have personally used Dataverse and collection. Although there's delay compared to SP since it sends request 1 by 1 to Patch to the server whereas for SP it goes parallelly. (This is explained in 1 of Shane Young's YT video).

 

[Personally, I have been using collection for bulk updates for a long time. There's another method by passing JSON object to Power Automate and let Flow update records in SQL. This too will take moderate time as it should, but your App can be less loaded on performance and be lightweight.]

 

Now coming to SQL, I haven't tried it. With respect to your use-case. I'd say you should go with collections and try the performance side-by-side.

Create a new screen and drop the gallery and insert the changes.

For your Tick or Cross, save the data into a collection with the response for each record.

 

Note: Collection always need to have primary ID/key/GUID to update existing record. So, make sure you have it in collection.

 

Then try Patching the collection to your Table. If SQL supports then entire collection will be updated at once.

If not, then you can loop and patch request one-after the other.

 

Hope this helps

Jsunnb
Helper I
Helper I

Thank you for the input, I'll look at how I can use a collection to patch a table and then do a test. It sounds like there might be some savings there and would be worth the effort of making the change.

Jsunnb
Helper I
Helper I

So I did a quick test and had it create a collection and do the gallery off the collection. It still takes the same time to populate the gallery since it still has to load the collection from the view. But once I have it, all the patching happens very fast since you see it instantly almost for the collection which is what I do first. And then the patch to the table just happens in the background and takes it's time.

 

Question though, this will mean people will be able to click multiple lines and initiate the patching potentially before the last one finished. How does that work, first in first out? Will the table patching not being done slow down the next collection patch?

It'll be a pretty extensive update to see it working in runtime so I thought I'd see what everyone already knew

Hi @Jsunnb ,

 

So, what you can do to make it more faster and efficient.

1. You can create records in collection for what you make updates to your gallery records. If you tick/cross 5 records then you add only 5 records into your collection.

2. Keep a single button on top, say "Save Updates" and then apply formula to Patch all records to the system. Once successful, clear the collection for next updates. Refresh the Datasource to see updates made to your list.

 

Let me know, which method you are choosing since the answer for your question will depend on it.

 

Hope this helps

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

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

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!      

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!

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 (5,048)