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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (48,050)