Selecting inlinks as inline field values depending on the field key

I have pages tagged with #person containing the person name (identical to the page name) and inline fields:

Name
Spouse:: [[spouse name]]
Parent:: [[parent name]]
#person

There may be zero, one or several Spouse and Parent fields.

What I would like to do:

Create table with Name, Spouses, Parents, Children
for each person P
display P, Spouse outlink(s), Parent outlink(s)
for each inlink
if P is mentioned in inlink source page as “Parent:: [[P]]”
then display inlink as Children

I would appreciate your help, or any reference to a similar topic in this forum - which I could not find. Many thanks!

Sorry but this is a little confusing.
How many tables you want?
Or all this in same table?
Better if you create a mockup of the wanted table.

Hmm… I think I understand now your goal.

Try this:

TABLE WITHOUT ID
  file.link AS Name,
  Spouse AS Spouses,
  Parent AS Parents,
  filter(file.inlinks, (i) => contains(i.Parent, file.link)) AS Children
FROM #person

(edited)

1 Like

Your dataview magic works beautifully!

I will now try to convert this into dataviewjs code, as I would like the result in an array and a markdown table. Wish me luck!

I’m not versed in js side, but in dataviewjs I think you can’t follow the same logic used in filter for Children…
But if difficult, you can run a dql query inside dataviewjs. Explore dv.tryQuery().

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