Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Update all changes of a collection into Data Source from Canvas App Power Apps

Update all changes of a collection into Data Source from Canvas App Power Apps

Collection is a better way to store local data without connecting data source directly. This makes apps faster. But if you forget to update to actual data source, the changes done to the collection data, you will loose all updates once you close the app.

So its very important to send collection updates back to actual data source. In this post you will know the options available to update source from collection.

Using Collect function to update

If the columns name of actual data source are same with your collection variable then you can use Collect method to update collection data to source.

Collect(YourDataSource, collectMyFirstCollection)

Lets take an example we have a loan entity with some columns in Dataverse. The loan records bound to gallery to display data. Loan Number bound to a label, Customer name bound to a label but amount is bound to a textbox so that we can edit. Take a button called update Source.

The requirement is to update all loan record amount to 65000. So you can change the amount for all records using the text box and in update source on select property, use below function to update source with the collection changes.

but before that define a collection object and bind to the gallery. On Start property of the app add Clear Collect.

ClearCollect(colLoan,Loans)

This powerfx will initialize a collection variable to store loans info and bound to gallery.

The Run On Start option will load the collection data into gallery.

In the update source button use following code. Collect(Loans,col

Now you will see all records from collection.

You can use ForAll powefxalso

ForAll(Filter(colLoan, ThisItem> 60000), Patch(Loans, Defaults(Loans), {hdfc_name: Name, Amount: 50000}))

Hope this helps.

For more info read this article.

https://learn.microsoft.com/en-us/training/modules/work-with-external-data/4-move-data-using-collect

Follow my blog for more trending topics on Dynamics 365, Azure, C#, Power Portals and Power Platform. For training, Courses and consulting, call to us at +91 832 886 5778 I am working more for community to share skills in Dynamics 365 and Power Platform. Please support me by subscribing my YouTube Channel. My YouTube Channel link is this : https://www.youtube.com/user/sppmaestro

You can enroll now !We are giving 30% discount on our Internship Program

Don’t miss the chance to participate in the upcoming Internship Program which will be done using Microsoft Dot Net Web Development Full Stack Technology. The new batch will be starting from May 20, 2024.  We will have most experienced trainers for you to successfully complete the internship with live project experience.

Why to choose Our Internship Program?

Industry-Relevant Projects
Tailored Assignments: We offer projects that align with your academic background and career aspirations.
Real-World Challenges: Tackle industry-specific problems and contribute to meaningful projects that make a difference.

Professional Mentorship
Guidance from Experts: Benefit from one-on-one mentorship from seasoned professionals in your field.
Career Development Workshops: Participate in workshops that focus on resume building, interview skills, and career planning.

Networking Opportunities
Connect with Industry Leaders: Build relationships with professionals and expand your professional network.
Peer Interaction: Collaborate with fellow interns and exchange ideas, fostering a supportive and collaborative environment.

Skill Enhancement
Hands-On Experience: Gain practical skills and learn new technologies through project-based learning.
Soft Skills Development: Enhance communication, teamwork, and problem-solving skills essential for career success.

Free Demo Class Available