Dataview plugin snippet showcase

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 DD ā†’ 03-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?

Nice! :grinning_face_with_smiling_eyes:

At the moment, no. I donā€™t think you can create a list of embedded links.
Iā€™m unsure if this would require writing to the file (which dataview doesnā€™t do).

OK - thanks for your help :grinning: :+1:

1 Like

Iā€™ve been using it to create a more manageable list of what articles Iā€™m planning to write for which markets in order of how ā€œfar alongā€ they are and what their status is (pitched, drafted, published, etc).

dataview
table file.size, market 
from "90 Articles"
where current-status = "seed"
sort file.size desc

I also combine it with the calendar plugin to list files created on a particular date:

dataview
list file.ctime 
where file.ctime > this.file.day and file.ctime < (this.file.day + dur(1 day))
sort file.ctime asc

You can change ctime to mtime to get files last modified on a particular date but I find that to generally be less useful for me personally.

I also like to use dataview to help organize some of my fiction.

dataview
table year, length, status, protagonist, location, pitch
from ""
where universe = "Verraine" AND status != "deleted"
sort year asc

coupled with YAML at the top of my novel index notes and my short fiction along these lines:

---
universe: Verraine
year: 450
status: begun
protagonist: Jack
location: Efrenzan
length: short story
pitch: "A young soldier arrives home on leave to find the village he left behind devastated ā€” and the girl who once spurned him, his only hope." 
---

lets me create a very useful chronological list of stories that take place in a particular universe (I have three that I write in regularly, depending on genre: science fiction, urban fantasy, and second world epic fantasy).

For example:

Note that Irella is a link. Iā€™m holding off refactoring everything to match that style because Iā€™m hoping weā€™ll be able to assign ā€œlinkā€ status on the dataview side instead of in the YAML and itā€™s not a huge deal right now, but you can do it by giving [[destination]] in the raw YAML. Obsidian wonā€™t recognize it, but dataview does.

For individual novels, it also lets me create an incredibly helpful outline, like so:

dataview
table chapter, location, time, pitch
from ""
where (story = "Civil Mage") AND (chapter != "00") AND (status != "deleted")
sort chapter asc

where the YAML style would be:

---
story: "Civil Mage"
protagonist: "Irella"
length: "chapter"
chapter: "02"
section: 2 - Call to Adventure 
status: "complete"
location: Oruku
time: day 0 (midsummer) 
pitch: Irella attempts to gain support from the new Soveriegn, Valentia, but is rebuffed as a political liability and shuffled off to the minor, ceremonial role of tomb-builder.  
---
28 Likes

For those who may not know, you can use emoji in frontmatter, which works just fine in dataview!

I use coloured squares to indicate the amount of work required for each of my assessments.

image

34 Likes

Iā€™m test-driving a version of this thanks to you @EleanorKonik and enjoying it so far.

Ooo, good call on the emojis @SkepticMystic . That will make many people very happy!

3 Likes

I love this idea!!

1 Like

If / when you get it set up to make a nice fancy ā€œinboxā€ for MOCs, report back, because I am very interested !

1 Like

Has anyone noticed the exclusion filter stopped worked recently, or is it just me?
I use Dataview as a way to generate my MOCs. My code hasnā€™t changed in a while, but for some reason it has recently started to include in the results the files that are supposed to be excluded.

TABLE from #mental-models or #principles or #problem-solving 
WHERE file.name != "000 Index.md" AND file.name != "020 Mental Models MOC.md"
SORT file.name asc

This very simple file name exclusion works here (Obsidian 0.11.5, Dataview 0.1.10 on Linux/AppImage):

table file.ctime, file.mtime
from "+Inbox"
where file.name != "+Inbox TOC"
sort file.mtime descending

Maybe you need to leave out the ā€œ.mdā€? file.name seems to work on the file title, actually.

6 Likes

Well, that is all it took. Thank you very much, itā€™s working :slight_smile:

2 Likes

How would one go about saying:
list from #dessert but not #icecream?

Iā€™ve tried a few things (from #dessert and !=#icecream) (with or without space between = and icecream but it doesnā€™t work. Iā€™ve also tried without the and.

I tried to exclude via the where clause, but thereā€™s no way I can see to exclude tags there; just path and name.

Hi @SkepticMystic. Awesome. Would you be able to share the code behind this?

2 Likes

I also just tried a bunch of tests, but I donā€™t think this is possible.

#foo and not #bar
#foo not #bar
#foo and !#bar
#foo !#bar

I think this is a useful and easy-to-implement suggestion. Perhaps post an issue on the GitHub page :slight_smile:

3 Likes

Itā€™s just a normal Table, only difference is that each of the notesā€™ metadata has an intensity: :green_square: field.

(Without the backticks ā†’ ā€œintensity: :green_square:ā€)

image

So the codeblock:

Table intensity
From #Assignments

Will give you the emoji :slight_smile:

image

I use the Emoji Toolbar plugin to more easily insert emoji

7 Likes

@SkepticMystic

I think this is a useful and easy-to-implement suggestion. Perhaps post an issue on the GitHub page

done

1 Like

Nice :slight_smile:

Regarding your second point in the gh issue, doesnā€™t this work? Where !contains(file.name, "Ice Cream")?

I use this to exclude templates from the results:

image

1 Like