Dataview, "contains", and links in frontmatter

Continuing the discussion from Dataview "contains" help:

Sort of continuing from the above thread, I’m trying to create a dataview query that checks if a certain frontmatter value is after a key and if so includes it in the table.

I’m creating a glossary and now would like to separate them by Language, so that notes that include French after Language would be included in a note called French.

So, this works:

```dataview
TABLE WITHOUT ID Lemma, Language, Definition
FROM "Lemmata"
WHERE contains(Language, "French")    <----- new part
SORT file.name asc

HOWEVER! I’m struggling with linking the dictionary note to the language note.
the above query works, but not if I “[[link]]” the language in the dictionary note, e.g.

---
Lemma: anecdote
Definition: A short account of a real incident or person, often humorous or interesting. An account which supports an argument, but which is not supported by scientific or statistical analysis. A previously untold secret account of an incident.
Etymology: Late 17th c., from French anecdote, from Ancient Greek ἀνέκδοτος (anékdotos, “accounts unpublished”), from ἀν- (an-, “not, un-”) + ἔκδοτος (ékdotos, “published”), from ἐκδίδωμι (ekdídōmi, “I publish”), from ἐκ- (ek-, “out”) + δίδωμι (dídōmi, “I give”).
Language:
  - English
  - Ancient Greek
  - "[[French]]"
---

If I leave it as French (without the quotes or the square brackets) the query lists it. But then It’s obviously not linked.

How can I achieve querying the language that is linked?

Thanks!

1 Like

WHERE contains(meta(Language).path, this.file.name) works for querying "[[French]]" but only if it’s the only language there is, i.e. Language: "[[French]]". I’m still struggling with Properties a bit, and they create a list if there’s more than one Language here, as in the example of anecdote above. If "[[French]]" is in a list (even alone) it doesn’t work.

I’m not sure (:sweat_smile: ) but maybe this could work ?

```dataview
TABLE WITHOUT ID Lemma, Language, Definition
FROM "Lemmata"
WHERE contains(Language, link("French")) 
SORT file.name asc
```

From Dataview’s documentation: link()

Now, in case you might have French as a text value within the Language key in some notes and as a link in others … Maybe this could also work :woman_shrugging: :

```dataview
TABLE WITHOUT ID Lemma, Language, Definition
FROM "Lemmata"
WHERE contains(Language, link("French")) OR contains(Language, "French") 
SORT file.name asc
```

(Disclaimer: I’m not really Dataview fluent :innocent: :sweat_smile:)

1 Like

That worked, thanks :slight_smile:

My pleasure :smile: !

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