Dataview : get a line in a note from today's date?

Hi,

I have a file with writing prompts per day of the year wrote like this : 04/02 - Writing prompt.

In the template of my today’s journaling note I would like to find in that file the line matching the date of today. I can easely modify the first file to make it easer to retrieved the data, but I have no idea at all how I can do it.

My guess is that I can prefix all dates with date:: and use dataview to find in content something like contains(“MM-DD”) but I have no clue on how to do that.

Thanks

I found the solution using query instead of dataview

file:"<name of my file>" content:"MM/DD"

The ouput above does not suit me though, I just want the line found, not the whole query output, any way to do that ?

Thanks

I still don’t quite sure about what you want.

Let’s say you populate your notes with inline fields like this:

# My note

blablabla

prompt:: 04/02 do this and that

blablabla

prompt:: 05/02 do other thing

Then you can use a query like this:

```dataview
TABLE filter(prompt, (p) => contains(p, "04/02")) as Prompts
WHERE prompt
```

This is a tricky way, because for now you can’t query the content of your note.

But there’s a way to query the content of tasks!

So, using tasks is another option, together with inline fields . Something like:

# My note

blablabla

- [ ] do this and that (duedate:: 2022-02-04)

blablabla

- [ ] do other thing (duedate:: 2022-02-05)

blablabla

With this option you can use a task query:

```dataview
TASK
WHERE duedate = date(2022-02-04)
```
1 Like

Perfect, I adapted my files to match your idea and it works perfectly, thanks a lot!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.