Note A and B have `key::[[X]]`. I query X. How can I display A and B in the query?

Let’s say I have note A and B with key1:: [[X]], note C with key1:: [[Y]]. In note X and Y I have both key2:: value. A random note R have key3:: [[X]].

I can use table file.inlinks where key2="value" to a table with the first column containing X and Y, and the second column containing A, B and R. But I want to get only notes linking to the results with key1, so there will be no R. Is there something like file.inlinks.key1.filename or something?

I think maybe you’re asking how to list pages that link to the current page via a specific Dataview field.

Let’s say that page A and B both have a field Product:: [[C]]. The following query on page C will list all pages that have a “Product” field that links to it:

WHERE contains(Product,

Sorry I wasn’t clear. I’ve updated my question. Can you check it again?

Hi Ooker, thanks for clarifying your question. I think I understand the contents of each source page in your example, but I don’t understand what the final table should look like. Could you clarify what outcome you’re looking for?

This is my understanding of your page data:

  • A: key1:: [[X]]
  • B: key1:: [[X]]
  • C: key1:: [[Y]]
  • X: key2:: value
  • Y: key2:: value
  • R: key3:: [[X]]

Could you provide the contents of the output list or table you’re trying to create? That would help me understand what you’re trying to accomplish.



It would be

| |B|

Is it clearer?

I think I understand now. It sounds to me like you’d like to see the relationship of pages where source pages point to destination pages through the key1 field. Is that right?

I was able to produce a table similar to what you describe using the following query:

TABLE WITHOUT ID key1, as "Page"
WHERE key1
SORT key1, Page

This produces the following table from the sample data:

1 Like

Sorry @Craig and @Ooker to “invade” your post exchange. But I ask this: do the query through the “file.inlinks” it’s an important startpoint, right? I.e. you want the “inlinks” to the notes with key2 = "value"
My point is: when we target the file.inlinks (by default a list/array) we get all the “inlinks” to that notes. No way to contour this. But we can “hide” some results from the output using the function filter(), i.e., selecting the values we want to see.
Try this test query (you can see both results: all the file.links and the filtered one - only the inlinks that have the field key1):

   filter(file.inlinks, (i) => i.key1) as "Filtered results"
WHERE key2 = "value"

If I misinterpreted the goal, well, ignore me.


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