Things I have tried
I’m building a Homepage in Obsidian and managed to find (from Resolved Help area) @ottovanluchene ’s solution on how to using Dataview list always today’s note as a link.
list
FROM "Daily Notes"
where file.day = date(today)
However, I’ve not managed to get the link to appear as an item in a bulleted list. So…
What I’m trying to do
I’ve tried to form the same query as inline JS - but as a total JavaScript newbie I have managed to find out that maybe it is something like the following
$=dv.list(dv.pages('"02-DailyNotes"').where(k => k.name.includes(xxxxx)))
but I have not been able to find out how to get the current date compared to the note name, hence the xxxxx string as a placeholder.
Any help appreciated.
Jigar
April 15, 2022, 7:08am
2
you can access note date using k.file.day, in case file name contains date.
https://blacksmithgu.github.io/obsidian-dataview/data-annotation/
.where(k => k.file.day = date(today))
Thank you @Jigar . However, I don’t seem to get that work properly…
From this inline query
`$=dv.list(dv.pages(‘“02-DailyNotes”’).where(k => k.file.day = date(today)))`
I get this error message
Dataview (for inline JS query ‘dv.list(dv.pages(’“02-DailyNotes”‘).where(k => k.file.day = date(today)))’): ReferenceError: Can’t find variable: date
Jigar
April 18, 2022, 11:32am
4
@ari.kontiainen
Below one works on my test vault. Please modify as per your vault.
dv.list(dv.pages('"Journal/2022/Apr"').where(k => k.file.name == moment().format('YYYY-MM-DD')))
In my test vault my daily notes name is “YYYY-MM-DD”.
I think you want “==” instead of just “=” that is k => k.file.day = date(today)
should be k => k.file.day == date(today)
Yes, this was very close. Adding ”.file.link” to the end gave me what I wanted.
$=dv.list(dv.pages('"02-DailyNotes"').where(k => k.file.name == moment().format('YYYY-MM-DD')).file.link)
Thank you @Jigar !
system
Closed
May 17, 2022, 5:40pm
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.