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 / Collection Not Clearing
Power Apps
Unanswered

Collection Not Clearing

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello, 

 

I am currently building an application for recording data from different locations. The app houses information such as Project, Location, Visit Date, Temperature, etc. for each entry. I want users to have the ability to make a brand new entry or load the last entry. To load the last entry, I set up a collection to retrieve this last visit information (based on project, location, and date) from my SharePoint list (initiated by clicking a button titled "Load Last Visit"). 

 

"Load Last Visit" button's OnSelect command is: 

ClearCollect(LastVisitCollection,First(Sort(Filter('DataSource1', ProjectNameStore=DataCardValue99.Text,LocationNameStore=DataCardValue98.Text),'Visit Date',Descending)))

 

My datacards then have the following Default code:

If(IsEmpty(LastVisitCollection.'Variable1'),Parent.Default,First(LastVisitCollection).'Variable1')

 

My OnSave command is (I do not want to hide the form to allow the user to make more changes):

SubmitForm(Form1);Clear(LastVisitCollection)

 

When I am submitting new information into this app and click the "Save" button, it saves the correct information into my SharePoint list, but then loads the last data collection's values into the datacards versus keeping the new information entered into those datacards. This is not good because I want the user to be able to make more changes to the form, but when old collection's data is loaded, it is impossible to make the correct changes to the new entry they just created. 

 

How do I save the new data and not load in the collection data unless the user clicks the "Load Last Visit" button?

 

Thanks!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,440 Most Valuable Professional on at

    Hi @Anonymous ,

    Sounds like a Navigation/Refresh order issue here. Are you staying on the same screen during this entire process?

  • WarrenBelz Profile Picture
    156,440 Most Valuable Professional on at

    Hi @Anonymous ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello, 

     

    I ended up actually having to use a Patch function to submit the form. The problem was not the collection not clearing, it was the SubmitForm() function resetting the drop downs to the first item in the list values. Instead of using SubmitForm(), I used a Patch() to submit all my column values, and then the Collect() and Clear() worked great!

  • WarrenBelz Profile Picture
    156,440 Most Valuable Professional on at

    Good to see @Anonymous - glad you got it working

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 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard