I have a gallery with the following Items property which enables a search text box and a drop down filter based on a specific Manager field. This all works fine.
SortByColumns(
Search(
Filter(
'IKEA Rota List',
false || IsBlank(ManFilter.Selected.Value) || Manager.Value = ManFilter.Selected.Value
),
NameSearch.Value,
"Title"
),
"Title",
SortOrder.Ascending
)
I want to add a toggle that refers to a Leaver date field. If on then only display records where leaver date is <> Blank (i.e. they are a leaver)
If off then display records where leaver date is blank.
Can someone help me?
@mmbr1606 worked it out, it wanted LeaverToggle.Checked rather than .Value
Thank you for swift response
whats the error you are recieving?
@mmbr1606 giving me an error in the If statement - I have checked the syntax of the 'Leaver Date' field name and it is accepting it in that part of the statement so I don't think it's the naming convention.
Hi @Mawdman85 , try something like this :-
Replace the LeaverDate part with whatever you are using to capture whether or not you want to filter it being true or not, this code essentially just checks if a date exists within a date picker or not, but you could easily replace that with a check box or similar.
If(
IsBlank(LeaverDate.SelectedDate),
SortByColumns(
Search(
Filter(
'IKEA Rota List',
And(
false || IsBlank(ManFilter.Selected.Value) || Manager.Value =
ManFilter.Selected.Value,
IsBlank(LeaverDate.SelectedDate)
)
),
NameSearch.Value,
"Title"
),
"Title",
SortOrder.Ascending
),
SortByColumns(
Search(
Filter(
'IKEA Rota List',
And(
false || IsBlank(ManFilter.Selected.Value) || Manager.Value =
ManFilter.Selected.Value,
!IsBlank(LeaverDate.SelectedDate)
)
),
NameSearch.Value,
"Title"
),
"Title",
SortOrder.Ascending
hey @Mawdman85
please try this:
SortByColumns(
Search(
Filter(
'IKEA Rota List',
false || IsBlank(ManFilter.Selected.Value) || Manager.Value = ManFilter.Selected.Value,
If(
LeaverToggle.Value,
!IsBlank('Leaver date'), // If the toggle is on, filter for non-blank leaver dates
IsBlank('Leaver date') // If the toggle is off, filter for blank leaver dates
)
),
NameSearch.Value,
"Title"
),
"Title",
SortOrder.Ascending
)
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings