Calling only .md files with Dataview

What I’m trying to do

I am wanting to limit the list returned by Dataview to only the results that are .md files that match. But my different efforts are all throwing up errors, and I have reached the limit of my weak understanding.

Things I have tried

Does file.ext = md require a command like LIMIT? Quotation marks? The problem is certainly between the keyboard and the chair, so I truly appreciate it. :wink:

What kind of a query are you running? All the normal queries using pure Dataview only handles .md files by default. So if you’re using javascript to read all the files, then you also need to use javascript to limit your query.

So please present your query so we can further help you investigate what’s happening. (And if you enclose the entire query (and/or example data) within four backticks, it’ll present itself nicely here in the forum)

1 Like

As @holroy mentioned, and bit me for 36 seconds :wink:

  1. It would be nice if you provide what you have until now (don’t be shy!).
  2. DataView only handles .md files, while DataViewJS handles all (many/most) files.

Until then, this is an example of how to limit/filter only on md files with DataViewJS:

```dataviewjs
let files = app.vault.getFiles();
let filteredFiles = files.filter(f => ["md"].includes(f.extension));

dv.table(["Name", "Path", "Type"], 
    filteredFiles.map(f => [f.name, f.path, f.extension])
);
```

Drop this in a note in a root, and you should get the entire vault.

Cheers, Marko :nerd_face:

> > ``` dataview
> > TABLE WITHOUT ID
>  > file.link as "",
>  > rank as "Rank"
>  > LIMIT file.ext = md
> > FROM "Ideaverse/Efforts/On"
> > SORT rank desc
> > ```

Without my attempt to limit to .md files, it lists .pdfs, etc. in the folder. I am a data hoarder of sorts, so this is overwhelming, of course. I just want a short list of the .md files that are actually ranked. I know I am looking right at the solution…feeling a little foolish. Thank you.

Ehh… Where do you see the other files? In the rank property?

It shouldn’t list them in the first column at all. This query in my vault:

```dataview
TABLE WITHOUT ID file.link
FROM "MaDo/pdf"
```

Says no result as it should do, and there are only PDFs in that file.

If rank is a list property with links, you should possibly try to use filter() on that list, but we do need to see some examples of what is happening at your end. It’s still not clear why or where you see any non md files.

Rank is a numeric property–trying to rank what I am working on by priority, so no links, only numerical standing.

This is the result:

Dataview: Failed to execute ‘limit’ statement: limit should be a number, but got ‘boolean’ (true)

That’s all it returns. Thank y’all so much for your help. Trying to learn from my mistakes.

Then just use the query without the LIMIT, and you’ll get all the md files.

> ``` dataview
> TABLE WITHOUT ID
> file.link as "",
> rank as "Rank"
> FROM "Ideaverse/Efforts/On"
> SORT rank desc
> ```

And you’ll get all the md files in that folder. If you wanted to limit the result set, you’d either use some WHERE-clause after the FROM statement, or potentially something like LIMIT 100 on the line after the SORT statement. That would give you the first 100 files after you’ve sorted your files.