cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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.

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (32,963)