The following code is filtering and sorting my gallery:
Sort(
Filter(ProjCollect,
'Doc Selection'.Value = "Drawing",
If(IsBlank(Dropdown_MDLRev.SelectedText.Value),true,Dropdown_MDLRev.SelectedText.Value = 'MDL Revision'),
If(IsBlank(TextInput_DWG.Text),true,TextInput_DWG.Text in 'Drawing Code'),
If(IsBlank(TextInput_Rev.Text),true,TextInput_Rev.Text in 'Drawing Revision'.Value),
If(IsBlank(TextInput_Title.Text),true,TextInput_Title.Text in 'Drawing Title')
),
'Drawing Code')
As you can see, the filter simply takes the entire list, extracts items labeled as "Drawing" and then filters it by some dropdowns and text input boxes so users can filter a growing list. The sort should then sort the list in ascending order for people scrolling to find something.
I've used the same type of data and the same sort methodology on another PowerApp which works fine. The data comes from a sharepoint list. The field in question is a concatenate of two other fields (e.g. 002-1804000 and C to produce 002-804000-C). The two fields being combined are a text field and choice field. The data being displayed in the Gallery looks like this:
002-1804000-C
002-1804136-A
002-1804139-A
002-1603353-A
002-1804010-C
002-1804144-B
..... and so on
If I switch the order from default (ascending) to descending it flips the list correctly but that one line item (002-1603353-A) sits there seemingly out of order. If I go into the sharepoint list and use the Sharepoint sorting feature on that column it all sorts fine without an issue. The 002-1603353-A goes right to the top. It's only within the Gallery that it refuses to sort correctly. I have two other galleries on the same page, pulling from the same list, that both sort their items correctly using the same filters and same code.
Things I've tried:
- I wondered if that column had become corrupted somehow so I created a new column with the same concatenate code and tried to use that to filter. Same problem.
- I tried switching to sorting with the 'Drawing Number' column which is the first part of the concatenate with the same result of that 002-1603353 item sitting there out of order.
- I deleted the text in the 'Drawing Number' column for the few items surrounding the oddball one, including that one, and re-entered the data to no effect.
- I created a second gallery using the same code thinking something had become corrupted in the gallery but no change in the sorting behaviour.
- I tried switching to SortbyColumns with the same results as the normal Sort function.
Thoughts?