Dataview plugin snippet showcase

Do you need “where any(rows.symptoms)” ? you have != null so that is all I think you need and also I agree with what @scholarInTraining said about the order.

1 Like

Changing the order fixed it! Thank you!

1 Like

I have
Updated: 2022-06-22 14:49:26
in the yaml frontmatter. And would like to show all notes which are “Updated” more than 2 month ago. This query only returns notes without Updated though :disappointed:

WHERE Updated <= date(today) - dur(2 month)

Any Idea?

@mbreiden It’s probably having trouble turning “Updated” into a date. The formatting for such strings is super picky. You could try replacing the space between your date and time with a T, or if your comparison doesn’t need to be so precise, you could use the DV helper function split to separate out the date part:

WHERE Updated AND date(split(Updated, " ")[0]) <= ...

I also checked for the existence of Updated first, since if Updated doesn’t exist we don’t want to try to split it!

that does work thanks… yeah I think handling dates is an issue as soon as you have different locale or formats.

I just found out that I did use the wrong syntax for the month in the dataview config. luxon/ at master · moment/luxon · GitHub but while that corrects an error in the display (month is now correctly displayed) it doesn’t change the issue which was solved by using the split

1 Like

Hello: I want to create a Dataview table in one file (“podcast sample note”) that pulls in more than one value from an inline field (“Podcasts::”) located in another note (“video sample note”). Here is the query language I have used:

When there is only one value for the “Podcasts” field in the “video sample note,” the resulting Dataview table in the “podcast sample note” displays that value–in this case, “video sample note,” as can be seen below:

However, when there is more than one value for the “Podcasts” field (when I add “podcast sample too” to the inline field)–regardless of whether the values are comma separated–the resulting Dataview table displays nothing.

Just to be clear, I don’t want the table in the “Podcast sample note” to display BOTH of those values from the “Podcasts” field in the “video sample note” (“podcast sample note” and “podcast sample too”). Instead, I want the table in the “podcast sample note” to display the name of the video file (“video sample note”) regardless of whether the video file has just one value or more than one value listed after the field (“Podcasts”).

Can anyone help me out here? Is the problem with my “annotation” or my “query”? Something else?

I’m not sure I totally understand what you are doing, but if sounds like you might want to look into the function contains.

Many thanks for the response. I took a crack at using the contains function and, after many failed attempts (par for the course when using Dataview), I believe I have gotten the results I wanted. Thanks for the suggestion.

1 Like

Can you tell me how group by works in Obsidian? I am trying to sum up my minutes of workouts each day. It seems simple enough but I am not getting the Sum correctly.

TABLE sum(rows.exercise) as WorkoutMinutes
WHERE exercise != null

I want to build a chart from my workout data over time but I don’t think this would work from obsidian chart data input. Please help - thank you so much :slight_smile:

Glad you got it working, Gaston!

Same here, same here. Thank goodness computers usually let us undo and retry. :slight_smile:

Is there any way to combine not the LIST/TABLE but the TASK query w/ regexreplace?

I am using the KANBAN plugin and utilize dataview to pull all those tasks into a list which I display in the sidebar to have them in view all the time. The problem is that dataview also shows the due date set by the Kanban plugin which I’d love to cut out by using regexreplace.

This is what my current dataview query code looks like:

WHERE !completed

And this is the result:

Is there some way to fiddle sth like

regexreplace(text, "\{.*$", "")

in there?

1 Like

Nice question! I don’t know how to do it in plain Dataview query language, but it should be pretty straightforward in dataviewjs. I’m imagining a map over the rows.text field after you have done the group (and all the rest of your query) but before passing to dv.taskList to display.
You might want “Fällig:” as part of your regex query unless you’re sure there will never be { in your tasks for any other reason?

Feel free to start a new thread if you have questions getting the dataviewjs to work! Meanwhile maybe some expert in this thread has an answer in the plain dataview query language!

Thanks for pointing out the “Fällig”, I’ve since replaced it with the original @ as trigger which might also make it somewhat easier to filter out via regex. I am used to the regular dataview syntax but have zero experience w/ the js version therefore help would be highly appreciated. :slightly_smiling_face:

1 Like

What is correct formatting of Obsidian link [[Link]] when I want to use WHERE filter?



type: [[grammar]]
origin: english


Dataview query

WHERE type = [[grammar]]

With this syntax will got 0 result.

Here’s a milestone tracker I use. It creates a nice view for tracking your progress along some hobby or project.

You create a normal markdown list, for example tracking your milestones along
the journey of learning Javascript:

- 2022-02-06 Wrote a "Hello world" script, and it worked!
- 2022-02-11 Learned how to fetch data from a URL
- 2022-02-28 Learned about Promises
- 2022-03-03 Learned about await/async
- 2022-05-02 Started working with NPM libraries
- 2022-07-10 Published my first code to Github

const startDate = '2022-02-05'
dv.table(['Time', 'Event'],
    .split('\n').filter(x => x.startsWith('- '))
    .map(x => { const line = x.match(/- (\d{4}-\d{2}-\d{2}) (.+)$/)
      return [moment(line[1]).from(moment(startDate), true), line[2]] }))

And Dataview can render it to look like this, giving you a nice timeline of your milestones:


Neat! I wonder: Can you use the implicit file.lists field documented here to avoid having to read the file?

Here is my DVQ:

TABLE without ID Link.up As “Main Category”,(Link + “(” + length( + “)”) AS “Category”, AS “Thought Note”, rows.file.cday AS “Date”
FROM #z/litnote and !“81 ADMIN”
Flatten Link
Group by Link
sort Link.up ASCENDING

And a screen shot of the output:

I can’t figure out:

  1. get a bullet point before each “Thought Note”, and
  2. get the date to line up more closely to the associated note name

Any suggestions?



Neat! I wonder: Can you use the implicit file.lists field documented here to avoid having to read the file?

Oh nice, that’s made it a bit simpler :+1: I’m always down to improve efficiency!

I also got rid of the startDate and just use the first bullet point for that now:

let t, s, r = dv.current().file.lists.values.filter(x => x.text.match(/^\d{4}-\d{2}-\d{2} .+/))
dv.table(['Time', 'Event'], => {
    let [_, a, b] = x.text.match(/^(\S+)\s+(.+)$/); [t, s] = s ? [moment(a).from(moment(s), true), s] : [a, a]
    return [t, b]

- 2022-02-05 Started learning Javascript
- 2022-02-06 Wrote a "Hello world" script, and it worked!
- 2022-02-11 Learned how to fetch data from a URL
- 2022-02-28 Learned about Promises
- 2022-03-03 Learned about await/async
- 2022-05-02 Started working with NPM libraries
- 2022-07-10 Published my first code to Github


This should be so simple but I’m having a brain freeze.
I have a very simple DVQ that lists all open tasks:

Task from “”
WHERE !completed

That query is listed on my Daily Note Page. I want the query to NOT include any tasks listed on that page itself. My daily note page is title by date. Thus if I do this:

Task from “”
WHERE !completed and !=“2022-02-17”

Then I get what I want. But I don’t want to “hard code” the date.

I tried using the date(today) type combination, but of course, that isn’t a string so it doesn’t work Also tried concatenating a string, but that didn’t work either. I can’t use file.cday because it would exclude other files created that day (not just the today’s daily note page, like I want).

I feel like I’m missing something very simple and straightforward.

Task from “”
WHERE !completed and !contains(,

Problem solved.


I have a tabel generated by dataviewjs.
I’m not sure if it has the same table style with dataview.

My issue is wth the above code, it is OK on the screen.
But, when I print out by “Export to pdf”, all of the contents including the header are disappeared.
The table borders are alive.

Obsidian : v0.15.6
Theme : Default

I don’t know whre I have to change to fix this. So, it would be great if someone give me a tip.


I didn’t change anything. But, It’s ok now. Maybe after restart???