I’m new to Obsidian and I really like the flexibility. But this can be sometimes overwhelming. At the moment I try to configure Obsidian the way I want to use it by reading a lot of blog posts, listening to YoutTube videos and copy&past config snippets.
It gives my all open tasks grouped by the page name. But the order of the page seems to be random. I would like to order the output by the name of the page (A-Z). Adding the “.sort()” was my first try. While it doesn’t create a error, the output is still the same.
1.To filter pages by page.file.ctime 2.To sort pages by page.file.name in ascending order 3.To filter tasks by an uncompleted task 4.To display the result as a taskList [with the desired structure]
Notes
Summary
Q1: How to sort the output by the name of the page in ascending order?
Summary_Q1
```js
dv.taskList(
dv
.pages('-"Templates"')
.file.tasks.where((t) => !t.completed)
.sort()
);
```
title: DVJS10_use_fTasks_filter_by_uncompleted_tasks_and_taskList =>1.To filter `pages` by `page.file.ctime` 2.To sort `pages` by `page.file.name` in ascending order 3.To filter `tasks` by an uncompleted task 4.To display the result as a taskList [with the desired structure]
collapse: close
icon:
color:
```dataviewjs
// M11. define pages: gather relevant pages
// WHERE_CASE_11: To filter `pages` by `page.file.ctime`
// SORT_CASE_12 : To sort `pages` by `page.file.name` in ascending order
// #####################################################################
let pages = dv
.pages(
'"100_Project/01_dataviewjs/01_by_example/Q83_taskList/Q83_test_data"'
)
.where(
(page) =>
page.file.ctime >= dv.date("1981-03-01T00:00:00") &&
page.file.ctime <= dv.date("1981-09-30T23:59:59")
)
.sort((page) => page.file.name, "asc");
// M21.define tasks: gather uncompleted tasks
// WHERE_CASE_11: To filter `tasks` by an uncompleted task
// (comments)SORT_CASE_12 : To sort `tasks` by `t.text` in descending order
// #####################################################################
let tasks = pages.file.tasks
.where((t) => !t.completed);
//.sort((t) => t.text, "desc");
// M31.Output tasks: [with the desired structure]
// #####################################################################
dv.taskList(tasks, true);