Hey Simon
This isn’t my plugin, I’m just a fan!
Regarding your question, I think what you have in mind could work! Checkout @arminta’s reply here, perhaps she can also give you some pointers.
@blacksmithgu posted this on GitHub in reply to my question regarding displaying modified time in a note:
This is now possible via inline queries; just put an inline code block in your file:
`= this.file.mtime`
Great!
Also works for other things like …
Last modified: `= this.file.mtime`
Last modified date: `= this.file.mday`
Tags: `= this.file.tags`
Aliases: `= this.file.aliases`
Really great!
Now we’ll only have to wait for …
- date/time string formatting
- date/time strings being localized into the currently set Obsidian language, not the system language
@SkepticMystic
I watched your video today (thanks for that!). Re your section on “lists”. I could not get any of them to work and I don’t know if perhaps the last couple of updates broke it or if I’m doing something wrong. Presumably I should be able to write list fieldInYaml from "Folder"
and get results, right?
With country: UK
in my yaml, and list country from "Film/Film Titles"
I get no results.
Apparently we can’t sort by computed fields?
My note names will always start with a 4 digit year in some folders (ie. 2019.Something) and dataview allows me to correctly extract/display this year from file.name
, but it won’t allow me to sort based on it:
```dataview
table regexreplace(file.name, "(?<=\d{4})(.*$)", "") AS Year
FROM "Unsorted/Projects"
WHERE landmark = "yes"
SORT Year desc
```
The table is there, File/Year columns and results, but sorting it by Year
won’t do anything be it ASC/DESC, I can pretty much use sort
with any undefined string, same result.
Here are two three other nice ones:
Assuming you use a location:
in your front matter (as I do for places of interest)
---
name: Berlin, Weltzeituhr
location: [52.52134162768218, 13.41327381161729]
---
you can create dataview inline external links to Google Maps and Street View like this:
`= elink("https://www.google.com/maps/search/?api=1&query=" + this.location[0] + "," + this.location[1], "On Google Maps")`
Google Maps Search Link created "live" from front matter data, using Dataview!
`= elink("https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=" + this.location[0] + "," + this.location[1], "On Street View")`
Google Street View Link created "live" from front matter data, using Dataview!
`= elink("https://www.google.com/maps/dir/?api=1&dir_action=navigate&destination=" + this.location[0] + "," + this.location[1], "Google Navigation")`
Google Navigation Link created "live" from front matter data, using Dataview!
These even work in PDFs generated from the note.
wow, that’s crazy!
Hee hee, yes! And useful.
Locate my daughter on the (Obsidian Leaflet) map, have a popup come up, click on the “Route” link, hop over to the map opening in the browser, click “Send to smartphone” … and start driving!
You guessed it—I have a location:
front matter entry for People, too.
Hi friends, I’ve made some posts showing some examples of how I use dataview:
Hope you find them helpful.
Birthday
in front matter and calculated:
---
birthday: 1997-05-17
---
\* `= this.birthday` (`= "Age " + (date(today) - this.birthday).years`)
For a little fun, leave out the .years
part …
Weird, it also doesn’t work for me. Maybe that isn’t supported anymore
How can I get table view to display the date in the same format I use in the YAML header (YYYY-MM)? I tried wrapping it in quotes but that doesn’t make it a string. I tried the concatenation trick and that gets me closer, but it doesn’t zero-pad the month.
Amazing, thank you!
There’s a feature request on Github that you might like to support: Is it possible to specify a format when displaying a date? · Issue #120 · blacksmithgu/obsidian-dataview · GitHub
Hi all, not a programmer at all and hoping someone can help.
Wanting to know if it’s possible to take a number of files with the following in YAML:
—
Name: [Bill Smith]
Reportsto: [Jane Doe]
—
and build an outline view eg.
Jane Doe
- Bill Smith
- Ian Holiday
- John Tan
etc
Possible? Thanks.
How did you get the table to alternate background colors on each row here? is that a css snippet too?
FYI @blacksmithgu was kind enough to implement this feature request I submitted and it was quietly slipped into the release notes recently.
Say you have files with a field named foo
.
Some have foo: A
and others have foo: B
.
You can now do:
table choice(foo = "A", "Aaaaylmao", "Booo") as myFieldName
And you will get exactly what you expect.
You can also NEST CHOICES:
table
choice(foo = "A",
"Aaaaylmao",
choice(foo = "B",
"Booooo",
"Yay")) as blah
sort blah asc
The basic syntax is:
result = choice(boolean test, true value, false value)
Suddenly all my dataview codeblocks are showing zero results. I have not changed anything. What has happened? any changes in code?
Does anyone have the same problem?
P.S: I had to change the code and go to review mode and correct it again to get the results again. That was a new bug, I really wish there was a forced refresh button in this plugin.
I had the same problem. It started when Obsidian updated and started indexing note content. I gave it a while, restarted Obsidian, and my dataview blocks worked fine
The unusual thing was that it didn’t go away even after many restarts. Also I notices that I had to make the code wrong, not just change it, to get back my results. They were always there and I was not messing with to need a update.