obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Bug report - References to attributes containing links to other notes is no longer working

Open spiritualgeek opened this issue 3 years ago • 5 comments
trafficstars

What happened?

I scanned through what was logged and didn't find anything. If it is a repeat, then please forgive me.

I have many queries that refer to an attribute reflecting the parent, sibling, or child of a note

This is used in queries to refer to attributes of the parent, child, or sibling. If one of these attributes does not exist on a page or does not contain a reference to a note, the query would still include an entry (but just have those as blank in the columns)

I suppose the behaviour was somewhat like a left join? It always worked throughout all the releases of version 4

So for e.g.

I have a dataview query in page and in the DQL I will do something like parent.state AS "PSTATE" and all would be fine (even if the attribute on the note was missing or blank) - i.e. a row would be returned. The parent attribute would be a simple link such as parent:: [[This is a note]] or parent:: or simply not captured at all

DQL

A very basic, sample, query would look like the following:

table without id year AS "YR", state AS "STATE", class AS "CL", parent.state AS PSTATE, (link(parent.file.link,parent.title)) AS "PTITLE", (link(file.link, title)) AS "TITLE", update AS "UPDATE", dateformat(file.mtime, "dd-MMM") AS "MOD"
FROM ""
WHERE (node="l3") AND type="util" 
AND contains(file.folder, this.file.folder) 
AND regexmatch("^temp-",file.name) = false 
AND regexmatch("^trk-",file.name) = false 
AND regexmatch("^moc-",file.name) = false
SORT parent.title desc, state asc, importance asc, year desc, file.mtime desc, title asc

JS

N/A

Dataview Version

0.5.20

Obsidian Version

0.14.12

OS

MacOS

spiritualgeek avatar May 20 '22 15:05 spiritualgeek

Are these defined in frontmatter? If so, Dataview swapped to the Obsidian standard for frontmatter links, which is to define them as

parent: "[[Link]]"

instead of

parent: [[Link]]

blacksmithgu avatar Jun 07 '22 06:06 blacksmithgu

I have a standard section at the bottom of each note where I define all my associations

So it's

parent:: [[This is a note]]

I.E. not in front matter

spiritualgeek avatar Jun 07 '22 17:06 spiritualgeek

A few thoughts:

  1. Try the latest Dataview 0.5.31 to see if it still occurs.
  2. Links still seem to work locally for me and in tests, so the other likely culprit is that the relevant pages are not being indexed. Try going to one of the pages that is not working and rendering
TABLE file.name
WHERE file.path = this.file.path

If the page is not being indexed, this will result in an empty table, which is a bug. 3. Check the developer console for index bugs.

blacksmithgu avatar Jun 08 '22 03:06 blacksmithgu

Not sure if this is related, but I have studio:: [[Ghibli]] within relevant notes, and a simple list query where contains(studio, "Ghibli") returns no results. What does work is where contains(studio, "[[Ghibli]]").

Is this the way it is supposed to work? I fear that many of my queries will not return the proper information because I forgot that I put link brackets around a word. This would make queries pretty long with 'or' conditions..

If this isn't the same issue, I'll open a new thread.

filmgal avatar Jul 12 '22 16:07 filmgal

Your issue is separate I think but that's intended behavior. Wikilinks are a separate object as compared to strings. Your first snippet is doing string checking while the second one is doing Link checks.

AB1908 avatar Jul 12 '22 18:07 AB1908