What I’m trying to do
I’ve set up a template for my daily tasks so when the daily tasks core plugin creates a new daily note for the day, it applies my template and pulls all of the unfinished tasks scheduled on or before that day. This is what I currently am using for the query:
[!todo] Do Today!
group by priority scheduled on or before today short mode not done
This works, however the line ‘scheduled on or before today’ literally means today, so every note created will always look the same. This basically makes the daily note setup kinda useless, since I can otherwise just keep recycling the same file every day. I would love to have it instead pull tasks which have a scheduled date which matches (on or before) the date the actual file was created, so each file shows differently.
Things I have tried
After searching the documentation and a lot of googling, I’ve surmised that the only real way to do this would be to either match tasks’ scheduled date with the file name (defaults to YYYY-MM-DD), or to the file’s created date. I couldn’t find anything helpful with matching the file name so I tried looking into the file’s created date angle. The best I can tell, I’d need to list the file’s created date as a property on the file and use that as a variable in my query.
So, I have this YAML at the head of my template:
created: “{{date}}”
Since the file is an auto-generated daily note created with my template when I open Obsidian every morning, the {{date}} should always match the date I want to use as reference for my tasks. So, I then tried several different things to match that with the scheduled date in the query, none of them working:
Query Line:
scheduled <= created
Error Message:
Tasks query: do not understand scheduled date
Problem line: “scheduled <= created”
Query Line:
scheduled regex matches {{date}}
Error Message:
Tasks query: There was an error expanding one or more placeholders.
The error message was:
- Unknown property: date*
The problem is in:
- scheduled regex matches {{date}}*
Query Line:
scheduled regex matches task.file.property(‘created’)
Error Message:
Tasks query: do not understand scheduled date
Problem line: “scheduled regex matches task.file.property(‘created’)”
Query Line:
scheduled regex matches created
Error Message:
Tasks query: do not understand scheduled date
Problem line: “scheduled regex matches created”
I’ve tried other stuff as well, but tbh I’ve been banging my head against this wall for so long I honestly don’t remember everything I’ve done, and I’m not against trying things again if suggested, on the off chance I messed it up the first several times. I’m very new to this plugin (literally installed it the other day) and honestly querying in general, so I don’t know if this is something that’s just out of scope for how I’m trying to do it or if I’m just trying too hard and doing it wrong.
I’ve looked into trying this with DataviewJS or JavaScript, but I know next to nothing about either so it’s been incredibly confusing and difficult to find anything helpful. I’ve found posts that are similar to this, but nothing suggested in those posts helped, and I’m just more confused tbh. I’d be open to taking this approach if this can’t be done in a regular query, I just don’t understand either language enough yet to figure it out myself.
If anyone could help me get this figured out, I’d greatly appreciate it!