Dataview plugin snippet showcase

@mdee makes good use of the Dataview plugin to set up a lightweight project and task management system based on PARA. It’s well done. See Project and Task Management workflow.

5 Likes

You can use Templater plugin too. It puts templates into the text and has a lot of other cool features, I prefer it over hotstrings

1 Like

It seems that the Dataview plugin can’t parse queries with accented characters like :

list from #début

Dataview: Failed to parse query (line 1, column 13): expected ‘and’ or ‘or’ or ‘&’ or ‘|’,/FROM/i,/SORT/i,/WHERE/i,EOF

Is there a workaround ?

3 Likes

I would add an issue on the github page. This shouldn’t be difficult to implement.

1 Like

It seems there is no like function? I want to list all the restaurants I have notes on but I have not gathered them with a tag (only occasionally need a restaurant). And I know I concequently added the word restaurant in the file.name.

Is that possible?

D&D Campaign cross-referencing with dataview…

  • I have a few basic types: faction, npc, location
  • I have some tagging conventions:
    • General region: #region/subregion/sub-subregion/…
    • Specific place: #place/settlement/loggers-camp or #place/town/phandalin/stonehill-inn

That feels chatty, but it comes pretty naturally. What that means I then have is:

A) a full index grouped by type:

## Locations
```dataview
list from "compendium"
where type = "location"
sort file.name asc
```

## NPCs
```dataview
list from "compendium"
where type = "npc"
sort file.name asc
```

## Factions
```dataview
list from "compendium"
where type = "faction"
sort file.name asc
```

B) Cross references can then be displayed to help hop between things without creating links/backlinks (if you want to reserve those for stronger meaning, e.g.)

A specific location can do the following to find related NPCs and log entries:

## NPCs
```dataview
list from #place/landmark/circle-of-thunder
where type = "npc"
```

## History
```dataview
list from #place/landmark/circle-of-thunder and "pc-logs"
```

A Faction adds an additional lookup for related locations:

## Locations
```dataview
list from #group/faction/bregan-daerthe
where type = "location"
```

Tag structure matters for me, e.g. because it is #region/subregion/sub-subregion … I can get a broader index of anything in the region by specifying “#region/subregion” in the from (as the listed results contain any included sub tags).

I hope this makes sense. :wink:

22 Likes

There will soon be functionality to have something like:

list from ""
where file.name contains "Restaurant"

But not currently

6 Likes

All my projects have a field in the frontmatter “completedDate”, which I leave blank in until they are complete. Is there a way to query for projects that are not yet completed? i.e. for an empty field? Or is it bad form to leave an empty YAML field?

Try adding where completedDate = null

12 Likes

Thank you @arminta. It works great. These work too: completedDate="" and !completedDate

6 Likes

You can now use the contains function!

list from ""
where contains(file.name, "Restaurant")

For more on the functions available, checkout this page.

12 Likes

Using the contains function, you should now be able to achieve this! Or atleast create a list of daily notes from a previous year.

list from ""
where contains(file.name, "{{tp_date:f=MM-DD}}")
4 Likes

Is there a log update fro this plugin? I could not find any on github

1 Like

log update? I’m not sure what you mean :sweat_smile:
The functions were released in this update:

image

Click on “Releases” on the right side to see a list of updates

image

2 Likes

A bullet list of what changed after the update
P.S.: Where can I find it?

Just to add in the link for @SkepticMystic’s picture
https://github.com/blacksmithgu/obsidian-dataview/releases

1 Like

Thanks! Links > Pictures of links :grinning_face_with_smiling_eyes:

3 Likes

Weird - it is returning 0 results. I set the folder (Journal/) wherein each year has a folder - but nothing. I changed it to this…

```dataview
list from ""
where contains(file.name, "03-10")
```

and got the list. Could you explain the bits in curly brackets. Very sorry, as I realise this is a painfully newbie request!

2 Likes

Is it working the way you want after the change? :slightly_smiling_face:

Ahh sorry, I assumed you were using the Templater plugin! The part in brackets fetches the current date {{tp_date}}2021-03-10 when you run the template.

{{tp_date:f=MM-DD}} returns the current month MM and day DD03-10.

f= means “use this date format:”

2 Likes

Ah! Putting it in my Daily Note template (yes , Templater) did the trick. I now get the list.
Ideally I would like each entry in the list to render in an ![[embedded preview]]. Is that feasible?