So actually you asking me about my use-case made me think more about it, and for at least half of them, I managed to come to a solution that doesn’t need the custom sort . Also, it wasn’t a big problem, more of a minor quibble. I was running into problems of this kind:
I have a column that’s supposed to contain a date. However, I wanted the date displayed in a particular format, which I couldn’t find in the list of formats for dates (I wanted the day of week). So I was using strftime()
to display it in the required format. The problem was that the column then is of Text type, and if I attempted to sort using that column, it would sort alphabetically rather by date, and I didn’t want to have two separate columns for sorting and display. So I thought if there was a formula sort, I could store the date as text of my required format, but use a formula to parse and sort it as a date.
Anyway, your asking me about it make me think that perhaps the custom format for date could do what I needed, and looking at the docs, I see that the Moment.js syntax for dates is supported, so I guess I can keep that column as Date (for sorting) and still have it displayed the way I want.
There’re still some other cases which are not covered this way, so for example in another column I want to display a date as ‘<date> (<days ago>)’, for which there’s still no way except to use Python string formatting, and then I would have the same problem of the Text column being sorted alphanumerically rather than as a date.
And if evaluated in a separate empty data engine (with only the supplied data), I have doubts it would enable all the functionality you actually need.
Well, I think that would enable enough functionality that can be enabled without extensive workarounds, and certainly it would be enough for my use-case. It makes sense to restrict users to only be able to sort/filter according to data that they can already see. Now, perhaps you could use conditional logic where if a user does have complete access to the date engine as an owner/editor, then the sort/filter formulas work exactly as formulas everywhere else, but if the user isn’t supposed to have access to the data engine, then their formula could be processed, as you say, by a separate empty engine with only the locally supplied data. I guess this way no user would actually be able to tell any difference, which means that this would enable all the functionality that anyone could reasonably need.
Another possibility that occurred to me was using some kind of local Python interpreter (say Pyodide) to evaluate sort/filter formulas rather than the data engine (the way the custom JupyterLite widget works, for example) but that’s probably too big a change to make for too small a feature. Still, I don’t know, maybe it could be worth it by enabling future features that are right now similarly restricted because of how the date engine works, but you would know best regarding that.