There's no way to eliminate the delegation warning while using Find/Mid in a Sort directly against Dataverse, those string functions are confirmed non-delegable.
The only approach that fully removes the warning:
Add a calculated column in Dataverse that stores the text after the first space. In Dataverse this is a Formula column using: Mid('Division Title', Find(" ", 'Division Title') + 1). Then sort directly on that column SortByColumns(MyDataSource, "new_sortcolumn", SortOrder.Ascending), which is fully delegable with no warning.
If adding a column isn't an option, load into a collection first:
ClearCollect(colDivisions, MyDataSource)
Then sort the collection:
Sort(colDivisions, Mid('Division Title', Find(" ", 'Division Title') + 1, 1000), SortOrder.Ascending)
This eliminates the delegation warning because ClearCollect loads all records into memory first. The sort then runs locally with no delegation concerns. The trade-off is that all records load on screen load, so for very large datasets it can be slow.
Best regards,
Valantis
✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.
❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).
🏷️ For follow-ups @Valantis.
📝 https://valantisond365.com/