cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
awalker
Helper III
Helper III

Offline app saves multiples of each item in collection in mobile app only

I am working on expanding my app to enable offline use. 

This is the function:

Collect(colMileageLog, {Title: varUser.FullName, Date: MileageLogDate.SelectedDate,
DateText: Text(MileageLogDate.SelectedDate),
DateNumber: Value(Text(MileageLogDate.SelectedDate, "[$-en-US]yyyymmdd")),
BeginOdometer: Value(BeginOdometer.Text),
EndOdometer: Value(EndOdometer.Text),
BusinessPurpose: BusinessPurpose.Text,
DailyMiles: Value(DailyMiles.Text)});

 

In the mobile app the function saves multiples of each entry into the collection. I'm not sure how to troubleshoot this, since the function only saves one of each entry when tested in the browser. Any ideas?

 

Greetings

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@awalker 
The COLLECT function inserts new records into the collection.  You'll want to use the PATCH function instead if you are wanting to update a record instead.

I wrote a step-by-step tutorial for beginners on how to build a real app with offline-mode. If that's something you'd like to learn I recommend you check it out 😉

Article - Power Apps Offline Mode: A Step-By-Step Tutorial
https://matthewdevaney.com/power-apps-offline-mode-a-step-by-step-tutorial/

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
mdevaney
Super User III
Super User III

@awalker 
The COLLECT function inserts new records into the collection.  You'll want to use the PATCH function instead if you are wanting to update a record instead.

I wrote a step-by-step tutorial for beginners on how to build a real app with offline-mode. If that's something you'd like to learn I recommend you check it out 😉

Article - Power Apps Offline Mode: A Step-By-Step Tutorial
https://matthewdevaney.com/power-apps-offline-mode-a-step-by-step-tutorial/

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Thank you. That is very helpful information.
I believe the reason my entries were showing twice in the gallery on my phone is that I am saving the collection to my device with each entry and on the screen with the gallery that shows the collection, I had  "OnVisible" load up the collection saved on my device. Consequently my gallery was showing the collection in powerapps and the collection saved on my device. This also explains why the browser tests did not have this issue. I guess saving to the device does not work in browser. 

@awalker 
Yes, exactly.  Please mark my response as the solution if I answered your question.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (68,348)