web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery display items ...
Power Apps
Answered

Gallery display items - Toggle to include records where date is not blank

(0) ShareShare
ReportReport
Posted on by 134

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?

Categories:
I have the same question (0)
  • Mawdman85 Profile Picture
    134 on at

    @mmbr1606 worked it out, it wanted LeaverToggle.Checked rather than .Value

     

    Thank you for swift response

     

    Mawdman85_0-1708356201342.png

     

  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    whats the error you are recieving?

  • Mawdman85 Profile Picture
    134 on at

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

    Mawdman85_0-1708355846507.png

     

  • Sickle-Cell Profile Picture
    600 Super User 2024 Season 1 on at

    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

     

  • Verified answer
    mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 400

#2
WarrenBelz Profile Picture

WarrenBelz 348 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 315 Super User 2025 Season 2

Last 30 days Overall leaderboard