I have a folder called Locations that has a note for each restaurant/cafe I dine at. In my daily notes, I link to the Location as required… I am trying to create a dataview that lists each place I eat, and when I last ate there… what I have so far is this query…
TABLE WITHOUT ID
file.link AS "Venue",
max(file.inlinks) As "Most Recent",
min(rows.elapsedDays) + " days" AS "Elapsed Days"
FROM "Locations"
WHERE !endswith(max(file.inlinks).name, "MOC") and (type="restaurant" or type="Fast Food" or type="Fish and Chips") FLATTEN (date(today) - max(file.inlinks).days).days as elapsedDays SORT max(file.inlinks) ASC
So I have three problems that I am trying to solve here, and keep going around in circles…
-
I have an MOC file, in neither of these directories, where I list places I would like to go but haven’t been yet, that file, ends in the word MOC, so the first part of my WHERE clause is trying to exclude that entry, but it doesnt work. Things still show up with MOC.
-
I tried to steal the elapsed days code from an example in the dataview example vault, but it is also not working and is related to issue 3 below.
-
I am using what I think i half clever, and half a hideous hack, in saying give me the max(file.inlinks) in order to grab the daily that most recently linked to the location in question. It works, but it feels kind of icky…
The mess I am in stems from the fact that I can’t find a decent online reference to how to handle the inlinks and outlinks objects in dataview… so is max(file.inlinks).name even a valid piece of query language or just some random thing I made up hoping it would work? What can I actually do with inlinks as an object? the max part works in so far as I do have a table on my note with the dates as links to the days I last ate at those restaurants… but I can’t seem to convert it to a date that I can then do some duration calculations on… also the rows object that I have stolen to try to make this work… I am note sure on the doco for that…
Happy to accept links to doco I have missed instead of actual solutions, but if this is really obvious then please help.
Thanks.