In bases, how can I use a formula to achieve “edited/created on this day”?
Similar to:
WHERE file.mday = date(<% tp.file.title %>)
Many thanks!
In bases, how can I use a formula to achieve “edited/created on this day”?
Similar to:
WHERE file.mday = date(<% tp.file.title %>)
Many thanks!
Seen these but not entirely sure how they answer my case, hence the question.
Give these a try using the Advanced filter:
Created today (host note being YYYY-MM-DD)
this.file.name == file.ctime.date()
Modified today (host note being YYYY-MM-DD)
this.file.name == file.mtime.date()
e.g.
```base
views:
- type: table
name: Table
filters:
and:
- this.file.name == file.ctime.date()
```
The beauty of @ariehen’s solution is that you can have one Base and embed it in multiple notes. And if you then ever want to revise the Base, you only have to make your edits in one place. I have gone from around 25,000 Dataview queries to about 30 Bases.
Thank you man, really appreciate this.
@Guapa indeed, this is exactly what I am trying to do with bases.
I initially misunderstood and was in a rush, but wanted to post more. This:
Guapa and Kaleo got it, but for anyone else interested: instead of creating multiple ```base code blocks in each YYYY-MM-DD
daily note, create a .base
for embeds (or add these filters to an existing .base; it doesn’t matter).
For example a bases-for-embedding.base
with this content:
views:
- type: table
name: all files
- type: table
name: created on this day
filters:
and:
- this.file.name == file.ctime.date()
- type: table
name: modified on this day
filters:
and:
- this.file.name == file.mtime.date()
When looking at the “created on this day” or “modified on this day” views in the .base itself, nothing should show up but with these:
![[bases-for-embedding.base#created on this day]]
![[bases-for-embedding.base#modified on this day]]
embedded in a YYYY-MM-DD daily note, you’ll get results for that day.
※ Not 100% reliable because we’re using ctime
and mtime
here, but should be fine for most folks.
A bit of an update:
A member in Discord asked about this, but was using MMMM DD YYYY, ddd
as their daily note format which the above won’t work for.
@purple penguin
shared a solution that looks good, no matter the host note’s name/format:
created on this day: file.ctime.date() == this.file.ctime.date()
modified on this day: file.mtime.date() == this.file.mtime.date()
How can I embed a base that only includes today’s daily note?
Embed it in the day’s daily note and only reference itself?
file.name == this.file.name
Thanks! But I was hoping to embed in another note besides the daily note.
Assuming a daily note of the format YYYY-MM-DD
, you could try file.name == today()
e.g.
```base
views:
- type: table
name: today's daily
filters:
and:
- file.name == today()
order:
- file.name
- file.links
```
Thanks! That was what I needed!