Query to find blocks created today

Hi all,

I wanrt to create a query to see all the blocks ceated today
I wrote this query:

#+BEGIN_QUERY
{
:query [:find (pull ?b [*])
  :in $  ?d
  :where
  [?b :block/created-at ?d]
]
:inputs [:today]
}
#+END_QUERY

But i do not get any results, where is the problem?

thanks

:today gives back yyyymmdd
Whereas :block/created-at is a timestamp in milliseconds since epoch.
You will need to use something like :today-start and then [(>= ?d ?start)]
Please refer to this section of the advanced query documentation:
https://docs.logseq.com/#/page/advanced%20queries/block/relative%20timestamp%20inputs

Thanks I get some results.
But strange results no TODO and many empty blocks.
I am trying to find block tagged with “note” but seems not working

#+BEGIN_QUERY
{
:query [:find (pull ?b [*])
:in $  ?start
:where
[?t :block/name "đź“Ś note" ]
[?b :block/refs ?t]
[?b :block/created-at ?d]
[(>= ?d ?start)]
]
:inputs [:today-start]
}
#+END_QUERY

One idea.
There is a property block/page to define the page the block is in?

I could use since I wrote all my note in the journal page, is that correct?

The property is block/page?

Thanks

Hi,

Do you know how to do the same query but instead of the :today input using the current page (journal page)?
In this way I can see also the todo I have to do tomorrow and so on.

Thanks

Did you enable block timestamps in the config?
Else it might only find pages.

:feature/enable-block-timestamps? false
This specifically needs to be set to true for it to work.

Yes, that’s exactly right.

You can’t use created-at with a journal page input, because the :current-page would return the :block/name (or original-name unsure) property of the current page.
The :block/journal-day property is, just like :today in the format yyyymmdd.
That’s not compatible with a timestamp since epoch.

The stamp :block/journal-page is compatible with SCHEDULED or DEADLINE?
I can use to see all the TODO that are SCHEDULED for that journal page date?
Thanks

Example this query in the journal page doesn’t work

Blockquote
#+BEGIN_QUERY
{
:query [:find (pull ?b [*])
:in $ ?current
:where
[?current :block/journal-page ?day]
[?b :block/marker “TODO”]
[?b :block/scheduled ?d]
[(<= ?d ?day)]
]
:inputs [:current-page]
:table-view? false
:result-transform (fn [result]
(sort-by (fn [d]
(get d :block/scheduled) ) result))
:breadcrumb-show? false
:collapsed? false
}
#+END_QUERY
Blockquote

What’s the mistake?

Thanks

As I stated :current-page is the name of the page, not the id. so you can’t do [?current
As well as that you wrote journal-page instead of journal-day.

[?journal :block/name ?current] ; or it is :block/original-name, not sure.
[?journal :block/journal-day ?day]

thanks I will try.
Sorry I am a bit slow :smile:

Curiosity did you have tried the new app Tana.inc?

No worries :slight_smile:

No, I stick with Logseq. It’s the only app I use honestly.

1 Like