Hi Everyone.
I have a template for a query for my weekly journal (that track my time spent on projects). At the moment I have the start and end date of the week hard coded in the :inputs field.
E.g. for my journal page 2025-W2 I have the following query:
#+BEGIN_QUERY
{
:query [
:find (pull ?project [*]) (sum ?duration)
:with ?b
:keys project duration
:in $ ?start ?end
:where
[?b :block/page ?p]
[?b :block/refs ?r]
[?r :block/name "timetracker"]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[?b :block/properties ?props]
[(get ?props :project) ?project-val]
[(get ?props :duration) ?sdur]
[(* 1 ?sdur) ?duration]
[?project :block/original-name ?project-name]
[(contains? ?project-val ?project-name)]
(between ?b ?start ?end )
]
:inputs [ 20250106 20250110 ]
:result-transform (fn [result] (map (fn [r] (update (:project r) :block/properties (fn [p]
(assoc p :days(/ (:duration r) 8) :hours (:duration r) :project (:block/original-name (:project r)))
))
) result )
)
}
#+END_QUERY
where I entered manually the date of Monday and Friday in the inputs.
Do you know how I could use automatically the date of the journal page on which the query is written? Note: In my case it does not need to be from Monday to Friday and this could also include the saturday / sunday if this would be easier.
Thank you for your support and kind regards