cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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

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.

Meneghino
Level 10

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

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.

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

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?

Meneghino
Level 10

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

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.

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

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.

Highlighted
Meneghino
Level 10

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

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.

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

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))

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

Meneghino
Level 10

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

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

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

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

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!!

Super User
Super User

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

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
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 90 members 3,906 guests
Please welcome our newest community members: