cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CarlosCalleja
Helper I
Helper I

Create an index for filtered data without using a collection

Hello, I'm trying to create an index only for certain records that satisfy a condition. For example filter the records where Color="Red" and then assign an index to this.

I don't think I can use a collection because of the amount of data that I have, almost 3,000 rows, this causes the app to crash when I try to use it. Is there any way to accomplish this? 

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @CarlosCalleja ,

 

What does the crash mean? Does it mean the delegation issue?


There is no clean way to create index in PowerApps. You can only add index value to each record through the ForAll function

If you want to create index for data without modifying the data source, collections are the only way. Please refer to the workaround from RandyHayes.

Clear(Col_Table1_Indexed);

ForAll(Col_Table1,
   Collect(Col_Table1_Indexed,
      Patch(Last(FirstN(Col_Table1, CountRows(Col_Table1_Indexed)+1)), 
            {Index: CountRows(Col_Table1_Indexed) + 1})
          )
   )

If the filtered records is less than 2000 rows, try to save the filtered records to Col_Table1, then the above workaround should work perfectly.

Sik

View solution in original post

4 REPLIES 4
v-siky-msft
Community Support
Community Support

Hi @CarlosCalleja ,

 

What does the crash mean? Does it mean the delegation issue?


There is no clean way to create index in PowerApps. You can only add index value to each record through the ForAll function

If you want to create index for data without modifying the data source, collections are the only way. Please refer to the workaround from RandyHayes.

Clear(Col_Table1_Indexed);

ForAll(Col_Table1,
   Collect(Col_Table1_Indexed,
      Patch(Last(FirstN(Col_Table1, CountRows(Col_Table1_Indexed)+1)), 
            {Index: CountRows(Col_Table1_Indexed) + 1})
          )
   )

If the filtered records is less than 2000 rows, try to save the filtered records to Col_Table1, then the above workaround should work perfectly.

Sik

View solution in original post

Thank you @v-siky-msft , with crash I mean the browser crashes every time I try to open the app, everything freezes and I can't do anything. I tried to create the collection on the OnStart property of the app with all the records, which is probably why this happens.

So, even if I have more than 3,000 records total, if after filtering I have less than 2,000 this will work?

Hi @CarlosCalleja ,

 

The crash you mentioned is more like a PowerApps configuration issue.

Could you try to Switch the following three Preview Features to see if the crash is fixed?

Snipaste_2020-06-12_09-28-36.png

 

Sik

Thanks @v-siky-msft , I have not tried it yet with a lot of data but I was able to create my index by filtering my data first (delegable) and then creating a collection out of that (non-delegable). So this solved my problem!
I still need to see if the app freezes when I use aaaall the data. 

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 Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,587)