Dataview plugin snippet showcase

Hey @mnvwvnm , apologies for the delay… I’ve been down with Covid this week after attending an induction day at my new teaching job last week. Thank you for your help, the first option worked beautifully! This uber newbie really appreciates your help! :smile:

2 Likes

It was a ‘bad’ start! I hope that everything is ok.

1 Like

:sweat_smile:
Oooh now i understand!!Thank you!!!
The error was in how i set up dataview.

table  tag1
from #idea
where contains(tag1, "[[§ Philosophy of Organism]]")

I tried everything and i found that the problem was in “quote” signs.
I thought yaml couldn’t support links
I really appreciate you help @mnvwvnm!!
p.s. sorry for my wacky english,i’m italian

1 Like

Ciao. Perfetto.
Il mio inglese è anche ‘wacky’. Io sono portoghese!

EDIT:
If you want just a LIST of all the notes with the tag1 [[§ Philosophy of Organism]] your can run this query:

```dataview
LIST
FROM #idea
WHERE contains(tag1, [[§ Philosophy of Organism]])
```

If you want a TABLE isolating that tag1 and hide all the others, you can try this:

```dataview
TABLE [[§ Philosophy of Organism]] as Mytag1, rows.file.link as Notes
FROM #idea
WHERE contains(tag1, [[§ Philosophy of Organism]])
GROUP BY rows.file.link
```

Mytag1 and Notes are the titles you need to add to the columns. You can choose what you want.

1 Like

Muito obrigado @mnvwvnm ! :smiley:

I should have asked for help much sooner… was wrestling with this thing for who knows how many days ahahah

Thanks again.Ciao!!

1 Like

I created a see also query. returns any linked mentions to your file that is not in the file. Great for easily exploring connections between your files. I was inspired by Wikipedia’s see also section at the bottom of their pages.

For this to work your first header needs to be the file name

```dataview
list 
from [[#this.file.name]] and
!outgoing([[# this.file.name]])
```

I also created a basic note template using the templater plugin that I would also like to share. To get the most out of this template, I recommend turning on Trigger Templater on new file creation on. I also set Create note in new pane hotkey to ctrl + n. I use ctrl + shift + n for the Note Refactor hotkey Extract selection to new note - first line as file name. Using this I can easily create notes on the fly.

---
tags: basic, new
aliases:
date created: <% tp.date.now() %>
---
%%
I add file links after topics, themes, and related

Why I use topics, themes, and related:
1. It gives me the flexibility of adding context and not having to include it directly in the note's content 
2. I create quite a bit of short, quick notes and so the ability to quickly add connections comes in handy a lot
3. I can come back to the note and add more connections very easily later on.
4. The added connections improves the graph view's ability to navigate, explore, and discover connections between your notes. 
%%
topics: 
themes: 
related: 

---
%%
templater plugin code to return the note's title when the template is inserted into the note
%%
### [[<% tp.file.title %>]]
- 

---
see also:
%%
returns list of linked mentions that are not present in the current note
%%
```dataview
list 
from [[#this.file.name]] and
!outgoing([[#this.file.name]])
```

(important tip - if you want to include the full dataview query syntax inside a code block like I did use 4 backticks to open and close the code block instead of 3.)

I plan on making more content in the future. If you want to support me you can buy me a coffee.

8 Likes

Thanks for all the incredible help on here yall, its been so helpful as i learn obsidian. Question - if i wanted to list the file.inlinks and file.outlinks in one column as part of a table (the other column being their folder location) is that possible? i can make a list of both, of course, but can use that list as part of a separate table? does this question make sense? can’t thank you all enough.

Hi!, did you create the class nav? I really like this approach…thanks!

Perhaps a silly question but I couldn’t find an easy answer on the forums: is there a way to format the date that is shown when using =date(today) on its own? By default it uses abbreviated day and month names, and I’d like to use the full names.

hi guys, kinda off topic but…

I came back to using yaml and using obsidian as a project manager. but I lost so much time to error’s in parsing yaml. mostly because of tabs inserted when I use Enter (using outliner plugin). I wish there was a plugin or something to let me know when there is an error in any yaml. anyone had the same problem or it’s just me being new to this topic

You could try the MetaEdit plugin. It helps adding/editing both YAML and inline Dataview fields. So you can always ensure both correct spellings and formatting. You can also set a list of predefined values for certain fields which is amazing.

1 Like

Any reliable way to filter by checking if an array includes a value? I have files with:

---
School: [NFHS]
---

and

---
School: [NFHS, FHS]
---

When I use the following, both files are returned:

```dataview
TABLE Season
WHERE contains(School,"FHS")

Any way to create a query that would only return the second file?
Thanks!

Thanks. It is looks like just what I need, but the documentation on it is so short and confusing. How I can edit yaml values from dataview tables? and what are those “::” . how i can use these predefined values I set in the plugin’s setting?

p.s. I get how predefined value works now. but how i am going to set it for nested values? for example I am going to set some predefined values for project.info.status? not just simple status?

is there a way to make these update like in the main not? they don’t get updated and recognized for backlinks as far as i can see

YAML in Obsidian needs to always be at the top of the note. Dataview allows using other YAML like fields and the :: is their syntax. These Dataview inline fields function just like YAML but can be used anywhere in the body of the note.

I’m not too familiar with the specifics of the MetaEdit plugin. I’d suggest posting in their Github or starting a new thread, since this post is specific to Dataview and also is meant to be a showcase rather than a help post.

1 Like

DataView returns both files because “NFHS” also contains the term “FHS”. Did u try if it works with a blank?

WHERE contains(School," FHS")

Thanks for the suggestion, but that does not work. Even it did work, I also have files with simply

---
School: [FHS]
---

that also would need to be returned. Thanks again!

Since 0.4.0, econtains or “exact contains” allows you to look for exact matches only rather than substrings. There isn’t documentation on it quite yet but the following should hopefully work

```dataview
TABLE Season
WHERE econtains(School, "FHS")
```
2 Likes

Thanks @M_bot, that worked great!

It ultimately isn’t a problem for my purposes, but I did note that I had a file that had a school not in an array (School: NFHS) that was still being matched with econtains. Once I put it inside brackets it worked as expected.

You can change the default date format and the default datetime format in the plugin settings, very last settings.

Also, from version 0.4.3 released a few days ago, we can use dateformat and format - So for example, to represent just the week of a date (format “W”) we can do something like dateformat(date(file.name), “W”) - relevant discussion: Is it possible to specify a format when displaying a date? · Discussion #362 · blacksmithgu/obsidian-dataview · GitHub

2 Likes