cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
YamiteKudasai
Helper III
Helper III

Improve Powerapps Performance when clicking buttons to Filter Collection

Hello Everyone,

 

Good day!

 

I need your help on how I can improve the performance when clicking a button. 

 

I have this collection that contains thousand of data/entries and there are two buttons used to filter the display in gallery.

 

example: the button one filters the collection request on which status = 'complete' and the other button filters the same collection with status = 'freeze'. The problem is when clicking button 1 from button 2 or vise versa it loads like 10-15 sec. Is this normal or still can be improve? 

Sample code of button 1:

 

 

ClearCollect(
   colFilteredUserRequests,
   Filter(
      colUserRequests,
      Status.Value = 'Complete'
   )
);

 

 

 

Sample code button 2:

 

 

ClearCollect(
   colFilteredUserRequests,
   Filter(
      colUserRequests,
      Status.Value = 'Freeze'
   )
);

 

 

Sample image: I click draft but takes 10-11 sec of time to load

YamiteKudasai_0-1637565092115.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @YamiteKudasai ,

 

As you mentioned there are thousands of entries in the source collection, and currently you are creating several collections from blank based on the buttons clicking and filter on a choice column value,  this two actions will both cost time.

 

I would provide you another approach to accomplish this scenario with better performance:

1. Change that choices type column to text while creating the source collection, use AddColumns function:

ClearCollect(
     colUserRequests,
         RenameColumns(
             DropColumns(
                   AddColumns(
                         YourTable,
                         "Status2",
                         ThisRecord.Status.Value
                   ),
             "Status"
             ),
         "Status2",
         "Status"
         )
)

 

2. OnSelect of those buttons, set to a variable to include the text, e.g. Active button:

UpdateContext({Qtext: "Active"})

 

3.  Use the variable as the criteria in the filter and append in Items of the Gallery:

Filter(
      colUserRequests,
      Status = Qtext
)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-jefferni
Community Support
Community Support

Hi @YamiteKudasai ,

 

As you mentioned there are thousands of entries in the source collection, and currently you are creating several collections from blank based on the buttons clicking and filter on a choice column value,  this two actions will both cost time.

 

I would provide you another approach to accomplish this scenario with better performance:

1. Change that choices type column to text while creating the source collection, use AddColumns function:

ClearCollect(
     colUserRequests,
         RenameColumns(
             DropColumns(
                   AddColumns(
                         YourTable,
                         "Status2",
                         ThisRecord.Status.Value
                   ),
             "Status"
             ),
         "Status2",
         "Status"
         )
)

 

2. OnSelect of those buttons, set to a variable to include the text, e.g. Active button:

UpdateContext({Qtext: "Active"})

 

3.  Use the variable as the criteria in the filter and append in Items of the Gallery:

Filter(
      colUserRequests,
      Status = Qtext
)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,460)