Hello,
Is there a way I can use a button to filter some results in my gallery based on an output of a label. There is a label in my gallery which holds a text output if another argument is true. The text output held by the label is "CAB". I need to be able to press a button and for all of the labels with the "CAB" value to be displayed. Is there a way of doing this? (Sorry I'm new to Powerapp design)
Solved! Go to Solution.
Hi @Station1901,
Do you want to filter your Gallery items based on an output of a label when you click a button?
I have made a test on my side, please take a try with the following workaround:
Set the OnVisible property of the first screen of your app to following:
ClearCollect(RecordsCollection, 'YourDataSource')
or
ClearCollect(RecordsCollection, 'The formula you typed within the Items property of your Gallery control') /* <-- Save your Original Gallery items into a Collection */
Set the Items property of your Gallery control to following:
RecordsCollection
Set the OnSelect property of the Button control (that you clicked) to following formula:
ClearCollect( RecordsCollection, Filter(RecordsCollection,FilteredColumn=Label1.Text) )
Note: The FilteredColumn represents the column in your data source, which you want to filter your Gallery items based on. The Label1 represents the Label control that you mentioned.
More details about the Filter function in PowerApps, please check the following article:
Best regards,
Kris
Hi @Station1901,
There is certainly a way to do what you are trying to do. It could be done using the UpdateContext() function and would be based on the formula that you use to derive the Text property of your label. Please let me know this formula and I can proceed.
Hi @Station1901,
Do you want to filter your Gallery items based on an output of a label when you click a button?
I have made a test on my side, please take a try with the following workaround:
Set the OnVisible property of the first screen of your app to following:
ClearCollect(RecordsCollection, 'YourDataSource')
or
ClearCollect(RecordsCollection, 'The formula you typed within the Items property of your Gallery control') /* <-- Save your Original Gallery items into a Collection */
Set the Items property of your Gallery control to following:
RecordsCollection
Set the OnSelect property of the Button control (that you clicked) to following formula:
ClearCollect( RecordsCollection, Filter(RecordsCollection,FilteredColumn=Label1.Text) )
Note: The FilteredColumn represents the column in your data source, which you want to filter your Gallery items based on. The Label1 represents the Label control that you mentioned.
More details about the Filter function in PowerApps, please check the following article:
Best regards,
Kris
hey @v-xida-msft,
Is it still possible to use this if the column in sharepoint I am filtering on is a choice column?
Thanks,
Aimee
User | Count |
---|---|
209 | |
94 | |
84 | |
49 | |
39 |
User | Count |
---|---|
265 | |
104 | |
104 | |
61 | |
59 |