Skip to content
Actions for Obsidian icon Home Actions for Obsidian 2024.2.1 › Actions

Actions for Obsidian › Actions › Get Dataview List

Queries Dataview and returns the results of a DQL list query as a flat list of strings.

This action requires the Dataview community plugin in Obsidian. For information about DQL (Dataview Query Language), see the Dataview web site.

Parameters

Vault

The vault to work in.

Type: Vault reference

DQL Query

Type: Text

Return Value

Text (list)

About Dataview

Dataview is an advanced topic that opens up a lot of possibilities for making sense of your notes and data. For information about DQL (Dataview Query Language), please see the related documentation on the Dataview site.

Examples

Please note: The examples will not explain the syntax of DQL (because the official documentation already does that well).

In my Obsidian note I have this DV query to get a list of notes tagged with #Actions-for-Obsidian from my Journals/Daily folder:

```dataview
LIST
FROM #Actions-For-Obsidian
WHERE file.folder = "Journals/Daily"
SORT file.name DESC
```

In Obsidian's Reading mode, the result is a linked list of notes like this:

  • Journal 2023-02-09
  • Journal 2023-02-08
  • Journal 2023-02-06
  • Journal 2023-02-03
  • Journal 2023-02-02
  • Journal 2023-02-01
  • Journal 2023-01-31
  • Journal 2023-01-30
  • Journal 2023-01-27

When the query is executed, Dataview constructs an Obsidian link for each hit and passes it to the renderer (Obsidian's Reading mode). So, under the hood, the above block basically looks like this:

– [[Journals/Daily/Journal 2023-02-09.md|Journal 2023-02-09]]
– [[Journals/Daily/Journal 2023-02-08.md|Journal 2023-02-08]]
– [[Journals/Daily/Journal 2023-02-06.md|Journal 2023-02-06]]
– [[Journals/Daily/Journal 2023-02-03.md|Journal 2023-02-03]]
– [[Journals/Daily/Journal 2023-02-02.md|Journal 2023-02-02]]
– [[Journals/Daily/Journal 2023-02-01.md|Journal 2023-02-01]]
– [[Journals/Daily/Journal 2023-01-31.md|Journal 2023-01-31]]
– [[Journals/Daily/Journal 2023-01-30.md|Journal 2023-01-30]]
– [[Journals/Daily/Journal 2023-01-27.md|Journal 2023-01-27]]

And that is pretty much exactly what this action will return: a list of plain-text Obsidian links, but without the bullet list prefixes.

If you use the same DQL query as the argument for the "DQL Query" parameter of the "Get Dataview List" action, you'll get the exact same list of strings.

Screenshot of an example workflow: a Text action containing the DQL query, a 'Get Dataview List' action using the query as parameter, and a result block showing list of strings described in text above.

And even if you change the query to add more data fields …

```dataview
LIST file.mtime
FROM #Actions-For-Obsidian
WHERE file.folder = "Journals/Daily"
SORT file.name DESC
```

… the output would still be a flat list of strings since that is what DQL's LIST query returns:

– [[Journals/Daily/Journal 2023-02-09.md|Journal 2023-02-09]]: 2023-02-09 14:52
– [[Journals/Daily/Journal 2023-02-08.md|Journal 2023-02-08]]: 2023-02-09 10:07
– [[Journals/Daily/Journal 2023-02-06.md|Journal 2023-02-06]]: 2023-02-07 09:20
– [[Journals/Daily/Journal 2023-02-03.md|Journal 2023-02-03]]: 2023-02-06 09:58
– [[Journals/Daily/Journal 2023-02-02.md|Journal 2023-02-02]]: 2023-02-03 09:35
– [[Journals/Daily/Journal 2023-02-01.md|Journal 2023-02-01]]: 2023-02-02 08:59
– [[Journals/Daily/Journal 2023-01-31.md|Journal 2023-01-31]]: 2023-02-01 09:57
– [[Journals/Daily/Journal 2023-01-30.md|Journal 2023-01-30]]: 2023-01-31 14:23
– [[Journals/Daily/Journal 2023-01-27.md|Journal 2023-01-27]]: 2023-01-28 16:17

Screenshot:

Screenshot of an example workflow: a Text action containing the DQL query, a 'Get Dataview List' action using the query as parameter, and a result block showing list of strings described in text above.

Use a built-in "Repeat With" block to loop over the results.

Pro Tips

If you are not interested in the note link, check out the LIST WITHOUT ID variant of the query.

Construct your queries directly in Obsidian and once you're happy with it, copy them into the action — you will save some time this way as the DQL debugging notices and error messages are more readable in Obsidian itself.