查询无scheduled的Todo(实用Query分享)

1.查询所有无scheduled(或deadline)的Todo
这个需求似乎困扰了大家很久,前两天天生在群里也提到了用get-else的方法实现,我后来便去查询了get-else的方法,无意中看到了有外国朋友推荐的missing? 似乎也能实现,并且理解起来比较简单,就试了试,没想到还真能用 :crazy_face:

#+BEGIN_QUERY
{:title "无scheduled的TODO"
:query [:find (pull ?b [*])
:where
[?b :block/marker ?marker3]
[(contains? #{"NOW" "LATER" "DOING" "TODO"} ?marker3)]
[(missing? $ ?b  :block/scheduled )]]
:collapsed? false}
#+END_QUERY

scheduled可替换成deadline。

2.查询所有已scheduled(或deadline)的Todo(前段时间倒腾出来的):

#+BEGIN_QUERY
{:title " 已scheduled"
:query [:find (pull ?b [*])
:where
[?b :block/scheduled ?d]
[?b :block/marker ?marker2]
[(not= ?d nil)]
[(contains? #{"NOW" "LATER" "DOING" "TODO"} ?marker2)]]
:collapsed? false}
#+END_QUERY

3.查询scheduled(或deadline)在某段指定日期内的Todo(也是之前写的,便于进行周todo、月todo查询):

#+BEGIN_QUERY
{:title ":date: scheduled在二月的"
:query [:find (pull ?b [*])
:where
[?b :block/scheduled ?d]
[?b :block/marker ?marker]
[(>= ?d "20210201")]
[(<= ?d "20210228")]
[(contains? #{"NOW" "LATER" "DOING" "TODO"} ?marker)]]
:collapsed? false}
#+END_QUERY

以后再倒腾出新的query会继续往这发 :grin:~

1 个赞
  • 请问怎么查一段时间内普通todo,就是没有标记scheduled或deadline的todo

  • 比如

    • 检索创建于20210201-20210215的所有任务

我用block/created_at between 稍微试了下,没成功…
之后再试试其他方法,要是有结果在这告诉你 :joy:

1 个赞

太棒了! :grinning:

#+BEGIN_QUERY
{:title “TODO”
:query [:find (pull ?b [*])
:where
[?b :block/marker ?marker]
[(= “TODO” ?marker)]]}
#+END_QUERY

1 个赞