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