-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IDEA] add second optional reverse operand to sort, nsort and sortcs operators #6423
Comments
Thanks @saqimtiaz that makes complete sense, but would prevent us from using multiple operands to support multiple sort fields – it sometimes seems like it would be handy to be able to things like |
Perhaps a |
I think, there are even more "sort" operators, that would benefit. eg:
Should it be an optional second operator or should it be a flag: eg: |
@Jermolene We do have a :sort filter run prefix, but it does not accommodate the use case of assigning the reverse argument from a variable or text reference. It can however with some creativity be used to sort by multiple fields.
@pmario that does not meet the need for specifying a reverse sort using a variable or text reference. |
Doh! Of course, thank you.
As a strawman, we could extend So, we'd have:
Or:
|
That could be an option. I am also considering the viability of extending filter suffixes to support variables, though we need to consider whether that might get too confusing:
|
The advantage of an alternative form of |
This seems more native in comparison to other suggested forms! |
Would it make sense to extend the
|
Hi @joshuafontany is the goal to be able to turn on or off reversing via a variable/transclusion? |
By my reading of @saqimtiaz 's post, yes. It is desirable to control sort order reversal via a contextual reference (var, transclusion). It makes more sense to me to use the |
@joshuafontany that is a good idea and worth considering as another improvement. However, having a way to trigger the Consider also that in the case of sorting large lists, performance is better to sort in the correct order, as opposed to sorting and then reversing the list. |
While the
sort[]
,nsort[]
andsortcs[]
operators support use of the!
prefix to reverse the sort order, this cannot be assigned from a variable and requires string concatenation to construct the filter.It is proposed to introduce a second optional operand that is the equivalent of using the
!
prefix. The following two filter expressions would be equivalent:[all[tiddler]sort[modified],[reverse]]
[all[tiddlers]!sort[modified]]
The text was updated successfully, but these errors were encountered: