Hi, Just added a sort icon into the gallery to filter by recent date. The Onselect of the icon has UpdateContext({SortDescending1:true})
and in the items of the gallery i currently have,
Filter(KBLCollection,StartsWith(Title,Srchbox.Text) && (Dropdown1.Selected.Value = "all" || If( Dropdown1.Selected.Value="Submitted",Submitted,!Submitted)))
I thought i could put in something like this,
Filter(KBLCollection,StartsWith(Title,Srchbox.Text) && (Dropdown1.Selected.Value = "all" || If( Dropdown1.Selected.Value="Submitted",Submitted,!Submitted))),"Date" , If(SortDescending1, Descending, Ascending))
but no luck, can you please assist
Thanks Warren, thats the one. All sorted now. Cheers
Thanks Warren, Gallery showing up now, no errors. however when i select the sort icon, nothing changes. The date fields in the gallery remain randomly throughout. I checked the onselect of the icon
UpdateContext({SortDescending1:true})
and the onselect of the gallery is
Sort( Filter( KBLCollection, StartsWith( Title, Srchbox.Text ) && ( Dropdown1.Selected.Value = "all" || If( Dropdown1.Selected.Value="Submitted", Submitted, !Submitted ))), "Date", If(SortDescending1, Descending, Ascending ))
Also when i select the sort icon, the blue box stays there (image below)
Hi @Matt383 ,
Dangers of free-typing - you left out Sort
Sort(
Filter(
KBLCollection,
StartsWith(
Title,
Srchbox.Text
) &&
(
Dropdown1.Selected.Value = "all" ||
If(
Dropdown1.Selected.Value="Submitted",
Submitted,
!Submitted
)
)
),
Date,
If(
SortDescending1,
Descending,
Ascending
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
before and after
Hi Warren, thanks for your reply. It no longer brings any errors, however now nothing shows in the gallery
Hi @Matt383 ,
You had an extra closing bracket in there
Filter(
KBLCollection,
StartsWith(
Title,
Srchbox.Text
) &&
(
Dropdown1.Selected.Value = "all" ||
If(
Dropdown1.Selected.Value="Submitted",
Submitted,
!Submitted
)
),
"Date",
If(
SortDescending1,
Descending,
Ascending
)
)
You could also toggle the sort with
UpdateContext({SortDescending1:!SortDescending1})
I am assuming here Submitted is a Boolean (yes/no) field.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.