cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Collection Storage Limit Issue while using in offline mode canvas app

Hi Experts,

 

I have ~9000 records in Population Master Entity and I have created a canvas app to run in offline mode. So, I have used the collection ( i.e Population_Master_Coll ) to store the Population Master Entity records. I have a QR scanner in my app which checks the scanned id with the Population_Master_Coll Collection records but for some scan, it is working and for some not. After doing some analysis it seems like the collection is not storing all the ~9000 records in it. I have enabled the delegation limit to 2000 in an advanced setting. But I also came to know that the delegation limit is not having any effect on collection storage. Collection can store any number of records, but in my case, it is not working properly. Users are running the canvas app via a Mobile device.

 

Is there any setting that I am missing or any kind of logic which I need to use in my canvas app to make it work? Or is there any other issue because of which my collection is not storing all data/ not able to validate the scan id with collection to display its basic information.

Please help me with this issue. Any Help will be appreciable.

Thanks,

Amit

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

From the snapshot below, you can find the delegation issue is due to the Vaue() function around AutoNumber field.

AutoNumber field acts as Text type in PowerApps, if you try to convert to Number type in Filter function, that causes the delegation problem.

Snipaste_2020-08-11_17-26-25.png

The workaround is to use Number field as the index of table, instead of AutoNumber field.  Try to create a new Number field and populate it via excel extension, then delegation issue is fixed.

If you still want the AutoNumber feature, it can be implemented by MS flow. Create a Automated flow triggered when a new record created, get the last Number value from entity, then update the new-created record and assign the incremental value to Number column.

Hope this helps.

Sik 

View solution in original post

6 REPLIES 6
mdevaney
Super User
Super User

@Anonymous 
Using the ClearCollect or Collect function on a datasource will only download the same number of records as the delegation limit (i.e. 2,000 records).  If you use the Collect function multiple times though it would allow you to increase the number of records in the collection beyond 2,000 records.

 

To download the entire datasource you would need to use some type of iterative collection.  However, that would be very slow and  unfortunately I don't have any code to share with you illustrating how to do it.

 

---
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."

 

GarethPrisk
Resident Rockstar
Resident Rockstar

Presumably you are using SaveData and LoadData functions to enable offline capabilities, which are inherently Collections.

Collect is subject to the app's record limit, as you noted. You can creatively overcome this limit, but adding to the Collection with multiple collects, like this: https://powerusers.microsoft.com/t5/Building-Power-Apps/Overcoming-the-500-record-limit-locally/td-p...

 

You can validate this in your app by adding a label with CountRows(YourCollectionsNameFromSavedData), and ensure that you have as many rows you need. My guess is that the SaveData/LoadData Collection is only getting 2000 records.

 

Does the Population Master data set change frequently? If so, you'll obviously need to keep the mobile apps up-to-date, and find a pattern which allows them to get the new set of data. If not, could you consider loading that table as static data to the app? That works offline, and could be referenced directly by functions/lookups/etc.

 

What type of Data Source is Population Master in? You mentioned Entity, so maybe CDS - but don't want to assume.

 

Does it have any sort of keyed/unique field?

Anonymous
Not applicable

Hi @GarethPrisk @mdevaney 

Thanks for your response!

It means that I have to use something like below to store all the entity data in collection: 

Concurrent(
ClearCollect(col1, Filter('Datasource', ID >= 1 && ID <= 2000)),
ClearCollect(col2, Filter('Datasource', ID >= 2001 && ID <= 4000)),
ClearCollect(col3, Filter(Datasource, ID >= 4001 && ID <= 6000)));
ClearCollect(colCombined, col1, col2, col3, col4, col5)

But I don't have any sort of keyed/unique field to iterate it to store 2000 records in different collections. If I will create a autogenerated field now, then it won't set the number for already stored data. Then how do achieve it now?

 

Please help me with this issue?

 

Thanks,

Amit

Basically, yes.

 

What is your data source?

How often is that data changing? New rows/edits to rows?

Are you using SavaData and LoadData functions for your offline scenario?

Anonymous
Not applicable

HI @GarethPrisk 

CDS is my data source.

And it's an Employee Entity data, so it may change but not frequently. I had created an Autonumber field and populated it via excel load but when I am trying to use its formula then it is not evaluation the range based on the SRNo Field. i,e 

 

ClearCollect(col1, Filter('Population ', Value(SrNo) >= 00001 && Value(SrNo) <= 02000));
ClearCollect(col2, Filter('Population ', Value(SrNo) >= 02001 && Value(SrNo)<= 04000));
ClearCollect(col3, Filter('Population ', Value(SrNo) >= 04001 && Value(SrNo) <= 06000));
ClearCollect(col4, Filter('Population ', Value(SrNo) >= 06001 && Value(SrNo) <= 08000));
ClearCollect(col5, Filter('Population ', Value(SrNo) >= 08001 && Value(SrNo)<= 10000));

 

and only 1st collection is storing 2000 data other are empty. Yes I am using, using SavaData and LoadData functions.

Please help me with this.

Thanks,

Amit

Hi @Anonymous ,

From the snapshot below, you can find the delegation issue is due to the Vaue() function around AutoNumber field.

AutoNumber field acts as Text type in PowerApps, if you try to convert to Number type in Filter function, that causes the delegation problem.

Snipaste_2020-08-11_17-26-25.png

The workaround is to use Number field as the index of table, instead of AutoNumber field.  Try to create a new Number field and populate it via excel extension, then delegation issue is fixed.

If you still want the AutoNumber feature, it can be implemented by MS flow. Create a Automated flow triggered when a new record created, get the last Number value from entity, then update the new-created record and assign the incremental value to Number column.

Hope this helps.

Sik 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,703)