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