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)
Solved! Go to Solution.
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.
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.
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.
User | Count |
---|---|
233 | |
109 | |
94 | |
59 | |
29 |
User | Count |
---|---|
293 | |
126 | |
106 | |
62 | |
57 |