Dataview table by file type

In dataview want to query for all files with the *.png extension, but am either not finding the correct query field or not understanding how I have the query grab *.png files.

I’m just trying to pull a list of images in my Obsidian notes into a standalone reference table.

I’m not a coder, so please have a little pitty and patience with me trying to figure this out :slight_smile:

Dataview only works with markdown files.

But you can get a list with a code block query:


Thanks for the response, I did get that figured out, it took embarrassingly long.

The problem that I have with the query is the unorganized response.

With the query is there a way to separate the path from the file name, and format that into a table; where filename is listed separately to the path so I can have it sort in alphabetical order, but still see when the file is stored?

With dataview and oql, I’ve tried to grab the linknames that had png in them, hoping that I could use that to sort alphabetically and then display the corresponding path of the link, but I can’t figure that out.

So I think I’m just not understanding the “filter” syntax. Using Dataview the simple

TABLE, file.outlinks

SORT file.outlink DESC

returns a nice table of of all my notes and the outgoing links. In the outgoing links I see the .png files listed as the link names (I change all my pasted image names to describe the image). However, if (as is my poor understanding) I add a filter:

TABLE, file.outlinks

WHERE contains(file.outlinks, ".png") = true

SORT file.outlink DESC

I get “Dataview: Query returned 0 results.”

Any pointers?

Well, I don’t have all the answers for you. But I can try clarify some.
About the way to organize the results of a query, I think that’s impossible.
I don’t use (and ignore) the Obsidian Query Language plugin. But I think you try to apply some ‘rules’ from OQL in Dataview and that doesn’t work!
As I said before, dataview only works with markdown files. Dataview doesn’t parse any (meta)data from other file types (you can’t target any value from these files).
On other side, when I said that you apply some usage expressions from oql, I’m thinking in this:

WHERE contains(file.outlinks, ".png") = true

The string “xxx” needs to be a value, not a part of that value! And if you target a link you need to write a link. (and remove = true). Example of right expression:

WHERE contains(file.outlinks, [[image.png]])

First, thank you for your patience.

I’ll look into this some more. It must be the way I think v someone who understands what’s going on. I was just slapping together two examples from the dataview docs. (It’s a shame that he didn’t include any fully executed examples for us neofites)

contains(file, "ctime") = true


contains("hello", "lo") = true

So, my logic says that it file.outlinks returns the outbbound file links as text that include the .png, and these can be tabulated, I should be able to apply a partial query. However, it is obviously not so.

I’ll keep using my stomping boots around this more to educate myself in the worse way possible. :slight_smile:

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