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!