I’m trying to setup a DV query as part of my Daily Note template; that would pull all of the new Notes created on the day of the Daily Note. I was trying to embed it in the template for my Daily Note. When I try to set it up, following the posts around here, I keep getting a full list of all of my notes that have “created” as one of the properties included in the note. The problem there is that all of my notes these days I include that property.
Any thoughts on how I can zero in on just the notes created for the day matching the date from the “created” property?
Here’s a screen shot of my template with the DV code I’m trying…
And then create the query where it only returned those files that were created with the date specified in the property?
For example. I might create tomorrows daily note today, and then select the “created” date to be tomorrow. When I run the code you gave me, it will also show the Daily Note for tomorrow, which I actually created today.
Am I clear on what I’m asking? Here’s a screen shot of what was returend for today actually.
On the Daily Note for today (DEC 28th), You can see that one of the notes is actually tomorrows Daily Note titled “December 29, 2023 — Friday”. But that note has the property field “created” labeled with the 29th date.
```dataviewjs
const currentCreated = dv.current().created.ts
const result = dv.pages()
.where(p => p.created && p.created.ts == currentCreated)
.file.link
dv.span(`Created on this day: ${ result.join(" • ") }`)
```
Which displays as this with some random test data:
You could of course change what text you join the links with, and other texts as you like.
An alternate version of the query above reusing the DQL query from earlier, but adding the magic of joining the result:
```dataviewjs
const result = await dv.query(`
LIST
WHERE created = this.created
AND file != this.file
`)
if ( result.successful ) {
const values = result.value.values
dv.span(`Created on this day: ${ values.join(" • ") }`)
} else
dv.paragraph("~~~~\n" + result.error + "\n~~~~")
```
This also excludes the current file, and adds a little bit of error processing. An advantage of this approach, is that if you don’t know a lot of coding, you could fiddle around with the DQL query until it displays the data you want, and then just insert that into the boilerplate code above and get the result joined up and displayed as you’d like. It also allows for extra processing, if that could be needed.
When one request is answered, it’s better to select a solution and start a new thread instead of introducing a new thing after the initial request has been answered.