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 / Filtering using a togg...
Power Apps
Answered

Filtering using a toggle or similar

(0) ShareShare
ReportReport
Posted on by 12

I have a Gallery/Form in which I am already filtering using this formula on the items property of the gallery 

 

Sort(

    Filter(

        AppColumns,

        'Date & Time Start' >= dpStartDate.SelectedDate,

        'Date & Time Start' <= dpEndDate.SelectedDate,

        Or(

            IsBlank(Dropdown2.Selected.Value),

            'Channel'.Value = Dropdown2.Selected.Value

        )

    ),

    'Date & Time Start',

    SortOrder.Ascending

)

 

Which works correctly. 

However in the gallery there are values which some users want to see 'Test Events' and other don't. I would like a toggle in which these Test Events will be seen or unseen in the Gallery. 

Test Event value is selected in the Live or Non-Live field within the form (values Live, Non-Live, Test Event) and the data is stored on a sharepoint list. 

 

What is the best way to toggle test event in or out of the Gallery

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    Rajkumar_M Profile Picture
    3,741 Super User 2025 Season 2 on at

    Hi @MattS2 

     

    Add a Toggle control to your screen and give it a name, such as ToggleTestEvents.

     

    Create a variable to store the state of the Toggle. You can initialize this variable in the OnVisible property of the screen:

    UpdateContext({ShowTestEvents: true}) // Default to showing test events

     

    Update the Items property of your gallery to include the condition for filtering out 'Test Events' based on the Toggle's state. You can use an If statement to check the value of the Toggle and apply the filter accordingly:

     

    Sort(
    Filter(
    AppColumns,
    'Date & Time Start' >= dpStartDate.SelectedDate,
    'Date & Time Start' <= dpEndDate.SelectedDate,
    Or(
    IsBlank(Dropdown2.Selected.Value),
    'Channel'.Value = Dropdown2.Selected.Value
    ),
    If(
    !ToggleTestEvents.Value, // If the toggle is off, exclude 'Test Events'
    'Live or Non-Live'.Value <> "Test Event",
    true // If the toggle is on, include all events
    )
    ),
    'Date & Time Start',
    SortOrder.Ascending
    )

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

     

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
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard