Hi.
I have the following code to search my gallery. The code is on the Items Action of the gallery.
Search(
'DataSourceName)',
SearchBox.Text,
"Name"
)
This works fine.
I would like to also include a filter on the items action to say Filter(DataSourceName, Name.Email = User().Email)
A) How do i include both the Search and the filter on the same items action.
I tried the below, but it doesnt like it
Search(
'DataSourceName)',
SearchBox.Text,
"Name"
) & Filter('DataSourceName,'Name'.Email = User().Email))
B) Once the filter is applied and step A above is working.
How can i create a button to say, clear the filter so every item is shown.
Thanks
Solved! Go to Solution.
If(varFilter,
Search(
Filter(
Sort(
DataSourceName
,"Name",
Ascending
),
'Owner'.Email = User().Email
),
SearchBox.Text,
"Name"
),DataSourceName)
Your brackets are all messed up
Search(Filter(DataSourceName, Name.Email = User().Email),SearchBox.Text,"Name")
Add a button. OnClick of button:
Set(varFilter,!varFilter);
Gallery Item code:
If(varFilter,Search(Filter(DataSourceName, Name.Email = User().Email),SearchBox.Text,"Name"),DataSourceName)
If(
varFilter,
Search(
Filter(
Sort(
'DataSourceName)',
Name,
Ascending
),
'Owner'.Email = User().Email
),
SearchBox.Text,
"Name"
)
)
There is no error with the code, but the gallery is not returning anything back?. If i remove the If(
varFilter, IT Works.
But i need the filter and i need the button to clear the filter?
Any ideas?
Show Your button on Click code
If(varFilter,
Search(
Filter(
Sort(
DataSourceName
,"Name",
Ascending
),
'Owner'.Email = User().Email
),
SearchBox.Text,
"Name"
),DataSourceName)
Your brackets are all messed up
Set(varFilter,!varFilter); my onselect button code.
Screen OnVisible:
Set(Set(varFilter,true);
Button OnClick:
Set(varFilter,!varFilter);
Gallery Item:
If(varFilter,
Search(
Filter(
Sort(
DataSourceName
,"Name",
Ascending
),
'Owner'.Email = User().Email
),
SearchBox.Text,
"Name"
),DataSourceName)
Thank you very much. That sorted it.
One last question, on the button - how can i make the text dynamic.
E.g. when i press the button, it filters the gallery - so i would like the button to say View All.
Then when View All is shown, i would like the button text to display, View My
Is that possbile?
Text Property of Button:
If(varFilter,"View My","View All")
Thank you very much. You have been a great help.
These little helpful tips go a long way in helping me (and others) in building robust solutions.
You are a credit to the community.
Thank you once again.
User | Count |
---|---|
160 | |
84 | |
70 | |
64 | |
60 |
User | Count |
---|---|
205 | |
146 | |
95 | |
84 | |
66 |