Hello Folks,
I have a column that have multiple status and I need to sort them not alphabetical
here's the current sort
Returned
Open
In Progress
Fulfilled
the requirements it should sort
In Progress
Returned
Open
Fulfilled
You can filter the collection prior to sorting it. See the modified code below for an example:
SortByColumns(
Filter(myItems, EndsWith(Name, "2")),
"Status",
["In Progress", "Returned", "Open", "Fulfilled"])
Hope this helps!
You can pass a "sort order table" to the SortByColumns function, and that will determine how the items are sorted. For example, if you have a collection defined as
ClearCollect(
myItems,
{ Name: "Item 1", Status: "Returned" },
{ Name: "Item 2", Status: "Open" },
{ Name: "Item 3", Status: "Returned" },
{ Name: "Item 4", Status: "In Progress" },
{ Name: "Item 5", Status: "Fulfilled" },
{ Name: "Item 6", Status: "Open" },
{ Name: "Item 7", Status: "Returned" },
{ Name: "Item 8", Status: "In Progress" });
Then the following expression will sort the items according to your requirement:
SortByColumns(
myItems,
"Status",
["In Progress", "Returned", "Open", "Fulfilled"])
See the screenshot below for an example of a gallery with this expression:
Hope this helps!