cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GT81
Regular Visitor

Dropdown in Offline mode doubles LoadData values

Hi Eveyone,

 

I am building an app where to start an inspection you must select a client form a dropdown.
My app uses SaveData on app start to save Clients data to local storage in case the device goes offline during inspection.
It does work in offline mode but the dropdown shows each client twice.
Any help would be appreciated
here is my code
App onStart()

 

If(Connection.Connected,
ClearCollect(
offlineClients,
Clients
);
SaveData( offlineClients, "offlineClients"); LoadData(offlineClients, "offlineClients"),

LoadData(offlineClients, "offlineClients")
);

 


clientDropdown 

 

If(Connection.Connected, Clients, offlineClients)

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Eelman
Super User
Super User

@GT81 

You don't need the first LoadData function. That's what is adding the double ups. LoadData() 'appends' data to a collection so acts like a Collect() function. 

 

See here

 

The loaded data will be appended to the collection. Use the Clear function before calling LoadData if you want to start with an empty collection.

 

What your code is doing is (when online);

1. Creates collection of Clients

2. Saves that collection to the device

3. Appends that same collection to the bottom of the Saved collection 

 

You should always run Clear(collectionName) before using LoadData just to be sure you start with a fresh / single count of your data.

 

 

View solution in original post

2 REPLIES 2
Erlandcrf
Microsoft
Microsoft

Hello @GT81 

Thanks for bringing this to our attention, this definitely looks like an odd behavior, but I think for this particular scenario a support request will be the best next steps as additional testing might be required, if you submit it, make sure to attach a copy from the App to facilitate the initial investigation.

You can also refer that incident to this post, so once the ticket it's resolved the resolution can benefit additional users that might face similar issue.

Thanks.

Eelman
Super User
Super User

@GT81 

You don't need the first LoadData function. That's what is adding the double ups. LoadData() 'appends' data to a collection so acts like a Collect() function. 

 

See here

 

The loaded data will be appended to the collection. Use the Clear function before calling LoadData if you want to start with an empty collection.

 

What your code is doing is (when online);

1. Creates collection of Clients

2. Saves that collection to the device

3. Appends that same collection to the bottom of the Saved collection 

 

You should always run Clear(collectionName) before using LoadData just to be sure you start with a fresh / single count of your data.

 

 

View solution in original post

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 Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,355)