Dataview plugin snippet showcase

Hi @SkepticMystic. I also use Emoji Toolbar plugin. Super thanx for sharring. I was not aware of the full potential of Yaml. I did watch a few YT video’s and if you combine Yaml with Dataview you can build great things. And in combination with the Templater plugin it becomes AWESOME.
I put this in a Template for each note when I create them
image
Then I use this Dataview to create the Dashboard

TABLE bnr, status, type, who
FROM "" and #BNR12583  
WHERE date(now) - file.mtime <= dur(365 days) 
SORT file.mtime desc

And this is the result

13 Likes

Nice! :grinning_face_with_smiling_eyes:

I could definitely learn more about yaml, still confuses me sometimes :sweat_smile:

How do you use the status field? What does all 5 colours mean, for example?

@arminta I am curious about a comment you made on github where you shared this image. What clever thing are you doing with your weekly reviews and would you mind sharing that here?

1 Like

Yeah, I kept trying with != instead of just !.

1 Like

This is probably elementary for some, but I struggled with these so I thought I would share (they mostly contain multiple negations):

How to say:

list from #recipe and #dessert but not #icecream and not #sorbet:

```dataview
list from #recipe and #dessert and -#icecream and -#sorbet
```

list from #recipe but not these two pages: “Main” and “Tag Index”

```dataview
list from #recipe
where file.name !="Main" and file.name !="Tag Index"
```

list from #dessert but no pages that contain either Ice Cream or Sorbet in the title:

```dataview
list from #dessert 
where !contains(file.name, "Ice Cream") and !contains(file.name, "Sorbet")
```
34 Likes

Exactly, this combination is very powerful.
I was thinking of making a template for listing all notes in a folder by using dataview, but there is not internal template for getting url and feeding it to dataview. I wonder maybe someone here can make one. It should not be hard. it just need to get the folder location relative to root of vault.

Is there a way to directly reference the note a dataview snippet is in? For instance to show some attribute, like the path, of the note? Along the lines of thisnote.filepath etc.?

Thanks for posting this! :slight_smile:
I think the logic can get a little complicated. It seems all the rules of first order logic apply:

As an example of De Morgan’s law applied to a tag query:

-#1 or -#2 == -(#1 and #2)

5 Likes

Let me see if I understand your goal.

Do you want to have a template that you can paste into any note, and then show all notes in that folder? Like this:

list from "{{folder_path}}"

Because the Templater plugin has a place holder for the folder of a note, in the second row:

So you could have:

list from "{{tp_folder:vault_path=true}}"

Which would do what I think you’re looking to do :slight_smile:

image

8 Likes

Interesting. I don’t think so. This shouldn’t be difficult to implement though, perhaps post a feature request on the GitHub page :slight_smile:

1 Like

I posted a feature request just now. Thanks for the suggestion.

1 Like

Exactly this, thanks. I am sure it was not in the list of internal functions before as I looked into int thoroughly. It must be added recently. that simplifies things so much. having a dynamic dir command at your finger tip by inserting a a template.

1 Like

Speaking of dynamic directory commands :yum:, the Snippets plugin lets you run console commands from inside Obsidian!

I use this snippet to easily have pandoc convert my note into Word.

 pandoc "{{file_path}}" -o "C:\Users\SK\Documents\{{file_name}}.docx"

Literally copy and paste, you don’t need to change the template at all; Snippet plugin has the {{file_path}} and {{file_name}} placeholders built-in.
You would press Ctrl + Shift + Enter with your cursor in the block, and it just runs!

I wonder if this could be used in any way with dataview… if you could integrate the command line with dataview, you could also use this plugin to make it simpler

10 Likes

Wow! that is so cool. I had no idea it’s possible. I was using Typora to use pandoc. It is one step closer to switch fully to Obsidian.

I am not sure what you mean by that, if you mean just selecting a note in a dataview list and pressing a hot key to convert it, I agree, that could be so useful. That kind of stuff is a new level of automation in obsidian imo. The first step should be the ability to edit properties in the tables imo. That one feature is going to be so useful

Where is this plugin? I can’t find it

You should see it on the Community Plugins page:

image

3 Likes

Haha I’m not even sure what I mean! I don’t know too much about cmi, but perhaps there is some integration to be found with dataview

1 Like

It shows now, sometimes searching in obsidian plugins don’t show anything for some reaon.
That is very cool, but it doesn’t work for me for some reason (I edited the url), maybe it works only on linux

I’m on windows.
Assuming you want to use command line, make sure you name the codeblock

```sh
ls
```

These are the settings I have in Snippets settings

  "sh": {
    "template": "{{src}}",
    "showModal": true,
    "appendOutputContents": true,
    "showRunButtonInPreview": true
  }
1 Like

thanks, it works now. I have to work with it more. I was thinking it is Linux only for some reason before, very happy to learn that it is now

You can use dataview to do rollups, several levels deep.

Example:

```dataview
table start-date, end-date, quarters, quarters.months.weeks.start-date
from #years
sort date asc

In my pages tagged #years I have a list of related quarters in link format:

Likewise, in my quarters pages I have a list of linked months:

And so on. The above query will produce a column that has all the start dates of all the weeks that are related to the months that are related to the quarters that are related to the year for that row.

Small example:

This isn’t maybe the most useful example, but I wanted to show a few levels of depth. Anyone familiar with rollups knows this opens up some really cool stuff, especially for reviews and such!

20 Likes