Dataview - nested query within lists

What I’m trying to do

Here is the structure of my files:

  • the trip/Honeymoon.md file has a cities: - [[city/Paris]] property
  • the city/Paris.md file has a country: [[country/France]] property

How can I list all my trips to France?

Things I have tried

The suggestion from here: Dataview subqueries - is real? - #4

It would work if trip/Honeymoon.md had a city: [[city/Paris]] property, but I have a list of cities instead.

Using contains(...) doesn’t seem to work.

I also tried to write a dataviewjs query to no avail. I’m a software developer so coding isn’t the issue: I couldn’t reliably filter by values which are links to pages, because they could either be [[city/Paris]] or [[city/Paris|Paris]] or [[Paris]] and so on.

Found an answer:

TABLE started_on
FROM "trip" 
WHERE contains(string(cities.country),"France")
SORT started_on DESC

It’s not elegant but it works.

I’ll leave the topic open just in case someone finds a better solution.

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