What I’m trying to do
I have some dataview queries set up that use
file.outlinks, for instance as part of a backlink query I use
WHERE contains(file.outlinks, this.file.link) AND ((other stuff)). I’m reorganizing my note system to work with the new properties feature, and I noticed that if the relevant link is placed in a property field and not in the main body of the note, it breaks the dataview query. If I add the same link to the main body of the note, then the dataview query works again.
This implies that links in the main body of a note are included in
file.outlinks but links contained in a property are not. I can update my dataview queries to compensate for this, but I’m just not sure what the relevant syntax would be to fetch the equivalent of
file.outlinks from the note properties, or (even better) if there is some more general syntax that would work like
file.outlinks but include both outlinks in the main body of the note as well as outlinks in properties.
Things I have tried
Like I said above I can just use a cludge to put the relevant link in the main body of the note instead of in a property, but I’d rather figure out how to do this the right way. I haven’t seen anyone else raise this issue and in general I’m not aware of what kind of documentation I should be looking at to address questions like this since it’s more under the hood than what is discussed in the basic Obsidian help material.
How are the links written in your YAML?
As far as I know, in source mode, they should look something like this:
- "[[Start Here]]"
- "[[Link notes]]"
I’m using that same syntax (not with a list in this case, but that shouldn’t matter):
related: "[[linked note]]"
In live preview mode, the link in the “related” property shows up as valid and correctly opens the linked note if clicked on.
Got it. Just wanted to check as I’ve seen some folks having a different format from older notes, plugins, etc.
Yup, that looks good.
Hopefully a Dataview wizard can weigh in.
Hi @excalibud ,
is this query what you want?
TABLE WITHOUT ID
FROM "Folder A/Note B"
Output looks like:
fronmatter in “Untitled 7” note
Output table from query above
If you want input with note link in output table, just remove WITHOUT ID (or add file.link before related), output will be like this
I appreciate the help @sysbreaker! But this doesn’t really solve my issue.
What I’m trying to accomplish in my query involves inspecting all outgoing links from a note, regardless of whether they are in the main body of the note or just from the properties. In other words, for this query I don’t necessarily know that the relevant link is going to be contained specifically in the
related property. Rather, I want the query to check if the outgoing link exists anywhere at all in the note.
In my previous PKM workflow I accomplished this using the
file.outlinks field, which contains all outgoing links in a note. However,
file.outlinks apparently does not contain links stored in properties, hence my problem.
I should also add that I haven’t been using YAML front matter prior to this, so I’m not aware if this issue is specific to the recent introduction of properties in Obsidian, or if it would have occurred even prior to that had I attempted to use
file.outlinks to fetch links contained in fields in the front matter.
I also switched recently to use proper YAML in my notes and discovered the same issue. Outlinks and inlinks from dataview don’t contain links that are defined in the properties.
As a workaround I switched to Dataviewjs which gives more tools to solve this issue. But it is a workaround. The property feature is not yet rolled out on all platforms yet. I think once it is, dataview will get an update that fixes this issue.
This is true DQL challenge :D,
this is what i came up with so far:
I have folder
Testing/OutgoingLinksTest/ with two notes and output file.
Note 1 has outgoing link inside note body.
Note 2 has 2 links in frontmatter properties section (with key out1: and out2:)
output looks like this:
reached with this query:
TABLE WITHOUT ID
file.link as File,
join(list(file.outlinks,link(out1),link(out2)),"<br>") as "Links"
BUT … big issue here is i have to know name of fronmatter keys, where are outgoing links stored.
without JS iam not able to get over it (but i don’t give up)
I’m still working on it so give me more time to figure out how to grab all links from note with dataview.
+1. I suspect this is more of an api issue as I noticed a couple other plugins that rely on outlinks have the same problem. Hopefully they will fix it soon and not claim this is intended behavior.
I have the same issue here.
I solved this problem by adding an OR condition in my dataview query including all the property names of the these outlinks, in your example excalibud, I would consider the:
WHERE contains(related, “[[linked note]]”) if this would work in your use case. Sorry if this answer does not make sense.
I have though another question to add, when I consider a list of links using the quotation marks then I got a notification from the property panel that I should change this to a list but this would create issues with my other queries, e.g. for example the Author field would change to “Author” so it would be inconsistent with the other files that are not including multiple links. However, if keep the field type as text the data queries still work, do you see any risk?
Apologies for the confusion for the second part of my message. The issue I had with this warning was because one of my first notes had defined the author as text (the value was null though and I assume the text type was given automatically). I changed the type of this first note through the properties panel and I don’t get this warning any more.
how were u able to solve the issue with dataviewjs?
This issue was resolved in a recent update to the dataview plugin. No need to do any fancy dataviewjs stuff, just update dataview.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.