Daily task management on desktop and mobile

Hi everyone,

I have been using emacs org-mode for my calendar and task management for a few years now. I recently upgraded my tablet and I’m looking into using Logseq for a mobile-native and org-friendly solution for note taking and task management.

There are two problems I’ve come across in this regard.

First: Setting up a daily agenda by journal day.— I understand how to set up a query using the :today keyword, but I would ideally like to see what I have scheduled on any day. In the following I’ve tried to write a query in which the date is coming from :current-page (I’m hoping I could use this as a default journal query.)

{:title "💪 TODAY"
    :query [:find (pull ?h [*])
            :in $ ?journal-day
            :where
            [?h :block/marker ?marker]
            [(contains? #{"TODO"} ?marker)]
            (or
             [?h :block/scheduled ?d]
             [?h :block/deadline ?d])
            [(= (str ?d) ?journal-day)]]
    :inputs [(clojure.string/replace (subs "[[2023-07-25 Tue]]" 2 12) "-" "")]}

The query currently doesn’t return anything, even with tasks scheduled for the appropriate day.

Second: Mobile task-management workflow.— It’s important for me to be able to check what I have scheduled on a particular day. However, as far as I can tell it’s not easy to make a new journal file for a day other than the current one from the mobile version of the application. Is this really the case? (I understand that I can write a file with the appropriate naming convention, but I’m looking for something simpler if it exists.)

Many thanks!

I should add: choosing a naming convention “yyyy-MM-dd EEE” for the journal files means that any scheduled todos already appear on those days as “Unlinked References”, which is a partial solution.

1 Like

I would be very interested in answers as well.

I don´t know if this is exactly what you are looking for, but I have a query to get all the LATER items scheduled whose deadlines were missed. For example, I have an LATER item that I should have done X days ago, it will appear in that query

#+BEGIN_QUERY
{
 	:title "🎯 Missed"
	:query [:find (pull ?block [*])
            :in $ ?start
            :where
              [?h :block/marker ?marker]
              (task ?block #{"NOW" "LATER" "TODO" "DOING"})
              (or
                [?block :block/scheduled ?d]
                [?block :block/deadline ?d])
              [(< ?d ?start)]]
    :inputs [:today]
    :collapsed? true
 }
#+END_QUERY

You can remove the collapsed? true if you want it to be visible by default.

Hope this is what you are looking for

2 Likes

Hey,

Thanks for the reply. I have something similar currently.

The key difference that I would like to implement is to do this without explicitly using :today as an input, but rather use the date of the journal page I’m visiting. That’s why I pass the journal day as a string and do some string manipulation first. I’m not sure why the query doesn’t work through.

So first off queries added to the default queries in the config file only show on today’s journal page and so it would make sense for those to just use :today.
If you want to use a template that gets added to each journal page with a query that shows the tasks for that day, you can use a query like this:

#+BEGIN_QUERY
{:title "Tasks"
 :query [:find (pull ?h [*])
  :in $ ?page
  :where
   [?j :block/name ?page]
   [?j :block/journal-day ?day]
   [?h :block/marker ?marker]
   [(contains? #{"TODO"} ?marker)]
   (or
     [?h :block/scheduled ?day]
     [?h :block/deadline ?day]
   )
 ]
 :inputs [:query-page]
}
#+END_QUERY

I would suggest linking to the journal page, then clicking it.
For me personally that seems a bit… complicated in and of itself.

I think you will find value in the discussion from this topic:

And in particular this post:

The second query I post there grabs a journal date reference from the parent block to use to display data.
This might be a nice way to check tasks for any date.

The query I posted before then becomes.

#+BEGIN_QUERY
{:title "Tasks"
 :query [:find (pull ?h [*])
  :in $ ?parent
  :where
   [?parent :block/refs ?j]
   [?j :block/journal-day ?day]
   [?h :block/marker ?marker]
   [(contains? #{"TODO"} ?marker)]
   (or
     [?h :block/scheduled ?day]
     [?h :block/deadline ?day]
   )
 ]
 :inputs [:parent-block]
}
#+END_QUERY

Hey,

Thanks very much for your helpful and detailed replies.

Yes, I understand that. My thought was that if I could get the query to work, I would include it explicitly in the journal template, so that it would appear on any day.

Thanks for this, I’ve marked this as the solution. I still have a number of questions though:

  1. What was wrong with my initial query? I thought that calling (str ?d) would return a string of the form “20230802”, and that that would match the input to the query.

  2. It turns out all of the string manipulation was unnecessary, since changing :query-page in your query to :current-page (which is what I had in mind) also works perfectly. Is it clear why I should use one over the other?

  3. Is it possible to recreate the effect of :group-by-page? with :result-transform or :view? I would ideally like to group the tasks by the day they are scheduled or due. A workaround is to place them on the day they are due and then pass true to :group-by-page?, but this is a bit annoying.

Thanks again!

I think the inputs part can’t handle clojure, but I’m not 100% sure. It was unnecessarily complex as well as you can see.

:current-page refers to the page open in the main window. :query-page refers to the page the query is actually on. So I generally use :query-page as it is more “stable”. :current-page is useful in certain cases. In your use case I felt :query-page was more appropriate.
(For example if you have the journal open in the sidebar, what do you want your query to use? That journal (=query-page) or the page open in the main window (=current-page). Similar question when you use block reference or embed of the query block.)

Not that I’m aware of. group-by-page is a special effect here :slight_smile:
It would be nice though! As well as that group-by-page and result-transform don’t work simultaneously :sweat:

2 Likes