Dataview query link from YAML

What I am trying to do

I would like to create a Dataview table with link to a field linked within the queried note. This is 3 “levels” of notes. For example:

  1. I have notes on people, e.g., this note on [[jane doe]]:
---
last_name: doe
first_name: jane
---

Friends with Jack and Jill
  1. I have notes where I reference people, e.g., [[meeting]]:
---
person_yaml: [[jane doe]]
location: work
---

person_dv:: [[jane doe]]

We had a productive meeting.
  1. I have a note which is an index of notes referencing people, i.e., [[table]]. This note includes the YAML from [[meeting]] as fields, including a link to the linked person note:
TABLE WITHOUT ID 
	location, person_yaml, person_dv, person_yaml.last_name, person_dv.last_name
FROM "dataview-links/meeting"

Issue

I expect [[table]] to include the 2 YAML fields from [[meeting]], with location displaying “work” as a string, and person_yaml displaying “jane doe” as a link. However, this doesn’t work, and instead person_yaml displays “jane doe” as a string preceded by a dot.

I do get the expected behavior when using Dataview inline field, i.e., person_dv. This also allows me to display text from within the linked note, i.e., “doe” from the last_name field of [[jane doe]].

I understand the Obsidian itself doesn’t allow for wikilinks in YAML (Wikilinks in YAML front matter), but per the Dataview documentation on links within queries, I believe that I should be able to query links in both YAML and Dataview inline fields, so I don’t understand why the YAML field isn’t displaying as expected.

Any clarification or suggestion would be very much appreciated!

Topic

Summary
  • YAML link vs. DVIF link
---
YAML_Y1: "[[Coffee]]"
---
DVIF_D2:: [[Tea]]  

Test

Summary
  • dataview: v0.5.46

Input

Summary

dictionary files

  • Location: “100_Project/02_dataview/Q97_link/Q97_test_data”

03

  • filename : dic_20160301
---
YAML_Y1: "[[Coffee]]"
YAML_Y2: [[Chocolate]]
---
DVIF_D1:: "[[Juice]]" 
DVIF_D2:: [[Tea]]  

DQL10_link_Coffee_or_Tea

Summary

Code DQL10_link_Coffee_or_Tea

Summary
title: DQL10_link_Coffee_or_Tea =>1.link: YAML_Y1: "[[Coffee]]" 2.link: DVIF_D2::    [[Tea]]  
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID 
      YAML_Y1 AS "YAML_Y1",
      YAML_Y2 AS "YAML_Y2",
      DVIF_D1 AS "DVIF_D1",
      DVIF_D2 AS "DVIF_D2",
      
      typeof(YAML_Y1) AS "T_Y1",
      typeof(YAML_Y2) AS "T_Y2",
      typeof(DVIF_D1) AS "T_D1",
      typeof(DVIF_D2) AS "T_D2"

FROM "100_Project/02_dataview/Q97_link/Q97_test_data"
WHERE YAML_Y1 AND DVIF_D2
WHERE file.path != this.file.path
Limit 5
```

Screenshots(DQL10)


DQL20_filter_by_link_Coffee_and_Tea

Summary

Code DQL20_filter_by_link_Coffee_and_Tea

Summary_code
title: DQL20_filter_by_link_Coffee_and_Tea =>1.link: YAML_Y1: "[[Coffee]]" 2.link: DVIF_D2:: [[Tea]]  
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID 
      YAML_Y1 AS "YAML_Y1",
      DVIF_D2 AS "DVIF_D2",
      typeof(YAML_Y1) AS "typeof_Y1",
      typeof(DVIF_D2) AS "typeof_D2"
FROM "100_Project/02_dataview/Q97_link/Q97_test_data"
WHERE YAML_Y1 AND DVIF_D2
WHERE file.path != this.file.path
WHERE contains(YAML_Y1, [[Coffee]])
WHERE contains(DVIF_D2, [[Tea]])  
```

Screenshots(DQL20)

1 Like

Wow, thanks. Forgot those quotation marks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.