You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Queries/Filters.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1279,6 +1279,19 @@ For example, this could be used to extract information from `task.originalMarkdo
1279
1279
1280
1280
<!-- placeholder to force blank line after included text --><!-- endInclude -->
1281
1281
1282
+
### Line Number
1283
+
1284
+
There is no built-in instruction to filter by the task's line number.
1285
+
1286
+
Since Tasks X.Y.Z, **[[Custom Filters|custom filtering]] by the task's line number** is now possible, using `task.lineNumber`.
1287
+
1288
+
> [!tip]
1289
+
> With `task.lineNumber`, the first line in the file is on line number `0` (zero), not `1` (one).
1290
+
1291
+
<!-- placeholder to force blank line before included text --><!-- include: CustomFilteringExamples.test.other_properties_task.lineNumber_docs.approved.md -->
1292
+
1293
+
<!-- placeholder to force blank line after included text --><!-- endInclude -->
1294
+
1282
1295
## Filters for File Properties
1283
1296
1284
1297
These filters allow searching for tasks in particular files and sections of files.
Copy file name to clipboardExpand all lines: docs/Queries/Grouping.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -828,6 +828,19 @@ group by function task.originalMarkdown.replace(/^[^\[\]]+\[.\] */, '')
828
828
829
829
<!-- placeholder to force blank line after included text --><!-- endInclude -->
830
830
831
+
### Line Number
832
+
833
+
There is no built-in instruction to group by the task's line number.
834
+
835
+
Since Tasks X.Y.Z, **[[Custom Grouping|custom grouping]] by the task's line number** is now possible, using `task.lineNumber`.
836
+
837
+
> [!tip]
838
+
> With `task.lineNumber`, the first line in the file is on line number `0` (zero), not `1` (one).
839
+
840
+
<!-- placeholder to force blank line before included text --><!-- include: CustomGroupingExamples.test.other_properties_task.lineNumber_docs.approved.md -->
841
+
842
+
<!-- placeholder to force blank line after included text --><!-- endInclude -->
Copy file name to clipboardExpand all lines: docs/Queries/Sorting.md
+48-1Lines changed: 48 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,8 @@ However, any `sort by` instructions in queries take precedence over these defaul
50
50
> To sort the results of a query differently from the default, you must add at least one `sort by` line to the query. The sort instructions you supply will take priority over the appended defaults.
51
51
>
52
52
> Adding `sort by` lines to the [[Global Query]] provides a way override to the default sort order for **all** searches (except those that [[Global Query#Ignoring the global query|ignore the global query]]).
53
+
>
54
+
> You may also find `sort by function task.lineNumber` to be useful to override the default sort order. See [[#Override the Tasks plugin's default sort order]] below.
53
55
54
56
## Custom Sorting
55
57
@@ -504,6 +506,26 @@ sort by function task.originalMarkdown
504
506
505
507
<!-- placeholder to force blank line after included text --><!-- endInclude -->
506
508
509
+
### Line Number
510
+
511
+
There is no built-in instruction to sort by the task's line number.
512
+
513
+
Since Tasks X.Y.Z, **[[Custom Sorting|custom sorting]] by the task's line number** is now possible, using `task.lineNumber`.
514
+
515
+
> [!tip]
516
+
> With `task.lineNumber`, the first line in the file is on line number `0` (zero), not `1` (one).
517
+
518
+
<!-- placeholder to force blank line before included text --><!-- include: CustomSortingExamples.test.other_properties_task.lineNumber_docs.approved.md -->
519
+
520
+
```javascript
521
+
sort by function task.lineNumber
522
+
```
523
+
524
+
- Sort by the line number of the task's original line in the MarkDown file.
525
+
- This is useful if you are unhappy with the [[Sorting#default sort order]].
526
+
527
+
<!-- placeholder to force blank line after included text --><!-- endInclude -->
528
+
507
529
### Random sorting
508
530
509
531
> [!released]
@@ -677,21 +699,46 @@ For example, when you `sort by done reverse` and your query results contain task
677
699
678
700
## Examples
679
701
702
+
### Sort tasks by due date, from oldest to newest
703
+
680
704
```tasks
681
705
not done
682
706
due today
683
707
sort by due
684
708
```
685
709
710
+
### Sort tasks by due date, from newest to oldest
711
+
686
712
```tasks
687
713
done
688
714
sort by done reverse
689
715
```
690
716
717
+
### Override the Tasks plugin's default sort order
718
+
719
+
If you are unhappy with the [[#default sort order]], this is one way to override it:
720
+
721
+
1. sort by the Markdown file's full path,
722
+
2. then sort by the task's line number in that file.
723
+
724
+
```tasks
725
+
not done
726
+
sort by path
727
+
sort by function task.lineNumber
728
+
```
729
+
730
+
Any other sort instructions can be added before these two, such as `sort by priority` or `sort by happens`
731
+
732
+
### Sort by multiple properties
733
+
734
+
1. task's status type (Sorted in the order `IN_PROGRESS`, `TODO`, `DONE`, `CANCELLED` then `NON_TASK`),
735
+
2. then the task's description, in reverse alphabetical order
Copy file name to clipboardExpand all lines: docs/Quick Reference.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ This table summarizes the filters and other options available inside a `tasks` b
51
51
|`description (includes, does not include) <string>`<br>`description (regex matches, regex does not match) /regex/i`|`sort by description`|||`task.description`<br>`task.descriptionWithoutTags`|
52
52
|`has tags`<br>`no tags`<br>`tag (includes, does not include) <tag>`<br>`tags (include, do not include) <tag>`<br>`tag (regex matches, regex does not match) /regex/i`<br>`tags (regex matches, regex does not match) /regex/i`|`sort by tag`<br>`sort by tag <tag_number>`|`group by tags`|`hide tags`|`task.tags`|
0 commit comments