What I’m trying to do
I have some notes set up as entities, i.e. Person, Organisation etc.
I am trying to create a list/table of people belonging to a given organisation on each organisation’s note.
I have frontmatter in each person. Since I found I can add links to the frontmatter I have been doing so, but most of my older notes have plaintext.
So, typically, the person frontmatter is one of the two examples below:
Example 1 (with links):
org:
- "[[6. Entities/Organisations/Some Org | Org One]]"
- "[[6. Entities/Organisations/Some Org | Org Two]]"
Example 2 (without links):
org:
- Org One
- Org Two
In my organisation notes I have frontmatter for aliases
. The main organisation name is always included in the aliases.
name: Org One
aliases:
- Org One
- Org One Alias
I want a dataview listing people who have a value from org
matching one of the values in aliases
.
Things I have tried
This works for Example 1 (where matching org
value is a link):
TABLE WITHOUT ID
link(file.name, name) AS Name, job_title AS "Job Title", Organisation, Alias
FROM #e/person
FLATTEN org as Organisation
FLATTEN this.file.aliases as Alias
WHERE icontains(meta(Organisation).path, Alias)
SORT name ASC
This works for Example 2 (where matching org
value is plaintext):
TABLE WITHOUT ID
link(file.name, name) AS Name, job_title AS "Job Title", Organisation, Alias
FROM #e/person
FLATTEN org as Organisation
FLATTEN this.file.aliases as Alias
WHERE icontains(Organisation, Alias)
SORT name ASC
I have then tried combining the WHERE
clauses using OR
, as I would expect this to work, but it gives the same result as the first dataview (where it matches org
values with links)
TABLE WITHOUT ID
link(file.name, name) AS Name, job_title AS "Job Title", Organisation, Alias
FROM #e/person
FLATTEN org as Organisation
FLATTEN this.file.aliases as Alias
WHERE icontains(meta(Organisation).path, Alias) OR icontains(Organisation, Alias)
SORT name ASC
I’d expect the OR
clause to bring in both sets of results, but it’s not working.
Can anyone shed any light on what I’ve done wrong, or misunderstood?
Cheers