Hi All,
I am struggling to find an answer on how to filter my gallery,
I want to have a button that when pressed will show only gallery items that have a blank textInput, its a specific textInput called txt_Fin_Time
My Items formula is
Sort(LoneWorker, ID, Ascending)
Button OnSelect formula
Filter(LoneWorker, If(txt_Fin_Time.Text = "", true, false))
This doesnt show any errors but doesnt work.
Any Help would be much appreciated
Ed
Solved! Go to Solution.
Hi @EdyMac ,
Firstly, you need to refer to the field in LoneWorker (I have assumed the name Fin_Time below. You also need to set a Variable with the button - you cannot set a Filter like you have attempted. Button OnSelect
UpdateContext({varPressed: !varPressed})
Screen OnVisible
UpdateContext({varPressed: false})
Items of Gallery
Filter(
Sort(
LoneWorker,
ID
),
!varPressed || IsBlank(Fin_Time)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @EdyMac ,
Firstly, you need to refer to the field in LoneWorker (I have assumed the name Fin_Time below. You also need to set a Variable with the button - you cannot set a Filter like you have attempted. Button OnSelect
UpdateContext({varPressed: !varPressed})
Screen OnVisible
UpdateContext({varPressed: false})
Items of Gallery
Filter(
Sort(
LoneWorker,
ID
),
!varPressed || IsBlank(Fin_Time)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi Warren,
Thank you for your reply, I have tried your solution word for word but it didnt work, my textinput is called txt_Fin_Time so i tried that but it says it creates a circular reference, the button I am using isn't in the gallery, its on the same page, i just didnt want a button on every item of the gallery, so I changed it to Set(varPressed, !varPressed) and Set(varPressed, false) and IsBlank(txt_Fin_Time), but it still says its creating a circular reference.
Ed
@EdyMac ,
You need to use the field name in your List LoneWorker - you cannot filter a data set on a Text control (it is not part of the data set). What field is txt_Fin_Time displaying from the List?
Hi Warren,
By field name do you mean, column name in my sp list ?, its Finish Time, i've tried both 'Finish Time' and FinishTime but neither works
Ed
Hi @EdyMac ,
Firstly, by "doesn't work", does it produce and error or simply not the result you expect. Also what is your data source (SharePoint?). As you are using a Text input, I assume the field 'Finish Time' is a text field in the data source? If this is SharePoint, go to your List Settings, select 'Finish Time' and look at the end of the URL at the top for the actual field name.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
No it doesn't show an error,
In edit mode it shows a delegation warning (but im not worried about that as i'll manage the list so it doesn't get too big), it only shows one row and all the Text Inputs are blank (like a blank form).
In Preview mode, the gallery is blank nothing showing at all.
In Play mode, the gallery is blank nothing showing at all.
Datasource is Sharepoint, it is a Text input and my data source field is single line of text, the name at the end of the URL is FinishTime.
@EdyMac ,
To simplify this so I understand exactly what you want here - I am assuming from what you have posted that you want to filter your gallery to show records from the List LoneWorker on the basis that: -
I have suggested that you set a Variable when the button is pressed and toggles the Variable varPressed between true and false with each press of the button
UpdateContext({varPressed: !varPressed})
As a result, the gallery Items should be
Filter(
Sort(
LoneWorker,
ID
),
!varPressed || IsBlank(FinishTime)
)
It is also important to initialise the Variable at Screen OnVisible
UpdateContext({varPressed: false})
Is there anything incorrect in my assumptions ?
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi Warren,
Appologies, your solution works perfectly, I had another hidden button that I had forgotten about and that was affecting it,
Thank you very much
Ed
User | Count |
---|---|
260 | |
109 | |
93 | |
57 | |
41 |