cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AmitLoh-Powerap
Kudo Kingpin
Kudo Kingpin

500 item limit in CDM entity search filter(need to switch to asp.net app if this exists for long)

500 item limit in CDM entity search filter, this makes it very dofficult to use for any business scenario(export, data analysis)

because I have 50k records and search filter may return sometimes 5k or 20k and I need to analyze this data(so export)

Currently its only exporting 500 first items which does not meet any business criteria(imagine you are doing google search and it returns only 3 items), sadly if this is permanant issue like sp list 5k limit I will have to inform this to our sponsors of the project and most likely as it does not meet business need to filter and export we will have to do asp.net app which we did not want to do.

I will atleast need some good workaround. One thing I observed is there is export data link in CDM screen(can you give me some workaround based on that?)

100 REPLIES 100

Hi Dang, PK Hong,

 

Do you want to collaborate on this? Please let me know your number or email, we can collaborate  until we get api access.

Hi all.

The most efficient way I have found so far to load all of a data source into PowerApps is the following:

ClearCollect(CachedInstruments, Sort('[Access].[Instruments]', ID, Ascending));
UpdateContext({MaxID: Max(CachedInstruments, ID)});
If(CountRows(CachedInstruments)=500,
	Collect(CachedInstruments, Filter(Sort('[Access].[Instruments]', ID, Ascending), ID > MaxID))
;
UpdateContext({MaxID: Max(CachedInstruments, ID)});
If(CountRows(CachedInstruments)=1000,
	Collect(CachedInstruments, Filter(Sort('[Access].[Instruments]', ID, Ascending), ID > MaxID))
;
UpdateContext({MaxID: Max(CachedInstruments, ID)});
If(CountRows(CachedInstruments)=1500,
	Collect(CachedInstruments, Filter(Sort('[Access].[Instruments]', ID, Ascending), ID > MaxID))
)))

Please note that the If statements are nested, so that it only advances if more records are present, if not then it stops.  It does not matter how many loops you copy-paste since perfomance will not be affected.

 

Another performance improvement is that you do not collect in 500 ID blocks (i.e. 1-500, 500-1000 etc.), but in 500 record blocks, so it does not matter if your data source has deleted IDs

 

As @mr-dang mentioned, of course you still need an ID column.  I don't normally use a timer to execute this (as @hpkeong has suggested) but normally have the landing page just welcome the user and have the above code in a "Proceed" button.  You can show progress to the user with a text box next to the button to show CountRows(CachedDataSource) so at least the user know that something is going on.

 

I have used the above for up to 5,000 records and it was quite fast.  I also have a 20,000 row table, but normally I load the piece I need (using the above code) once the user selects the group for which he wants analysis.  He does this in the app itself.

This is cool! I think we can also do paging >next 500 with your approach. So clearcollect and on > click get next 500 instead of scrolling behavior which is fine but does not have great user expirience when user wants to find how many?

Agreed @AmitLoh-Powerap, there is no current solution to the "how many" question except loading all records into a collection and then doing CountRows on the collection.

Of course, as soon as CountRows will be delegated then the counting issue will go away.  I hope it won't be long now.

I applied the code sent by Meneghino and its working! One issue I am seeing is in the end it adds 500 last batch as duplicate. So if I have 3.5 k records it adds 3k to 3.5k as duplicate that makes it 4k.

Hi @AmitLoh-Powerap

Are you sure that you have increased the If statement numbers by 500 units exactly each time?  Also, are you sure the If statements are all nested?

If you paste the code I can give a quick look.

thanks! this works excepts it adds 500 dups only in the last.

ClearCollect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), Country = Dropdown2.Selected.Country));
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(PRCWithReimbursementV2, RecordId)});
If(CountRows(CachedInstruments)=1000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=1500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=2000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=2500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=3000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=3500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=4000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=4500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=5000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=5500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=6000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=6500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=7000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=7500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=8000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=8500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=9000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=9500,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))
;
UpdateContext({MaxID: Max(CachedInstruments, RecordId)});
If(CountRows(CachedInstruments)=10000,
Collect(CachedInstruments, Filter(Sort(PRCWithReimbursementV2, RecordId, Ascending), RecordId > MaxID && Country = Dropdown2.Selected.Country))

))))))))))))))))))))

Had a look and didn't see anything wrong...strange.

In any case, how fast is performance with 10,000 lines?

I have exported multiple times and each time it gives me last 500 dup. It takes 40+ seconds as I have 70 columns with 300k records. I am doing country based filter so 10k is fine but 40+ seconds is not great. They have one magical method in their export to csv in entity CDM ng-click="$ctrl.selectFormatAndExecute(format)"

 

I have requested them to expose via powerapps. This method-selectFormatAndExecute exports 300k records to csv within 30 seconds!!

Hi @AmitLoh-Powerap@Meneghino

 

Thanks for sharing the 500 Limits filtering.

I have never tried nor checked on data> 500. Appreciate the sharing.

I tried but no LUCK! Only first 500 shown. Strange.

Maybe My ID problem

 

For Pagination, @AmitLoh-Powerap, you may refer to my Useful Features of PowerApps - Pagination which i posted couple of months ago. I will put it to PowerApps Community Blog later, too.

 

TQ

hpkeong

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (91,042)