Returning a note if at least one value from a YAML scalar matches

Things I have tried

My code:

TABLE WITHOUT ID file.link as "Feature"
FROM "features"
WHERE team_name = this.file.name AND type = "feature"
SORT file.link desc

What I’m trying to do

If there’s a note like this:

---
type: feature
team_name: [FOO, BAR]
---

the query should return this note, because at least one value matches. So far it only looks for 100% matches in the team_name key.

One question and one explanation:

  1. What’s the name of your note file? FOO? BAR?
  2. team_name = this.file.name is an ‘absolute’ declaration. You have an list/array in your field team_name. So, you need to choose one. For that you need to use de function contains(field, "value"):
WHERE contains(team_name, this.file.name)

or

WHERE contains(team_name, "FOO")

1 Like

What’s the name of your note file? FOO? BAR?

I’m afraid I don’t understand. Do you mean: do these names correspond 1-1 to actual notes? Like, is there actually a “FOO” note? Then yes.

If you add the condition team_name = this.file.name or contains(team_name, this.file.name), then this.file.name refers to the filename of the note where you put your dataview query!
team_name = this.file.name means “give me the list of the notes/files where the field team_name have the value (exact value) equal to the title of the note where I put this query, i.e, this note”.

1 Like

Then my answer still stands. The note name from which I’m querying is exactly the same as in the team_name key.

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