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!
See:
and
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.