Query links in a hierarchy

What I’m trying to do

I am building a compliancy register and there is some hierarchy to it. I have a certain theme (for example Anti money laundering). Below each theme, there are a number of requirements (A customer is identified according to the requirements in Law X, transactions are monitored, etc.). Some requirements have one or more measure(s) that we implement to be compliant (for customer identification this could include require tax ID, requiring passport copy, proof of address, etc.).

Simply put, I have:
a. Theme

b. Requirement

c. Measure

I try to make a table in the theme notes with each associated measure, but I haven’t been able to find a solution. I also want to accomplish this the other way around. A measure might also be associated to more than one theme.

In short, I would like to see the measures like asking tax ID, requiring proof of address etc. on the anti money laundering theme page.

I try to avoid adding each theme manually to each measure.

Things I have tried

I have tried a number of things, but I haven’t been able to find a way to query the properties of the notes that the measure is linking to. I have also tried using a combination of backlinks from measure + links from requirements. I have also queried AI tools.

Is there anyone who tackled this issue before?

I have trouble unterstanding the structure of your notes. Which properties do you have and which notes do have those properties?

In general, you can access properties of other notes by file("path").properties.property.

Hey Zodian, let me elaborate on the structure.

In a note about a measure, I have a property called ‘requirements’ where I link to one or more requirements that the measure relates to.

In a requirement, I have a property called ‘theme’, where I link to the theme that the requirement is related to.

So for example:

Note in the measure folder: (eigenschappen is Dutch for properties)

Note in the requirements folder:


In the Theme Anti Money Laundering, I would like to add a Base tracing back all the measures belonging to that theme, as displayed below this paragraph. I need to hop from Requirements to Measure somehow, even though there is no property in requirements which links to measures.

Thank you for clarifying this. I now understand what you’re trying to achieve.

First, while I think this should be possible with bases, it will be more difficult when you have multiple links in your properties. My example will not work for list properties right now.

But as a starting point, when you create a base and embed it in your theme note (Anti Money Laundering), then this filter file(note.requirement).properties.theme.linksTo(this) should give you all measures for which their requirement note links to the theme note.

I only tested this in a very simple setting, so it might need adjustments to work in your case.

In your “Measures” view (in the base in the theme note), give this filter a try:

Requirement.asFile().properties.Theme == this.file

That assumes measure notes like:

---
Type:
  - Measure
Requirement: "[[Identification of clients]]"
Description: Client submits proof of address prior to acceptance
---

and requirement notes like:

---
Type:
  - Requirement
Law: EU AML Act
Theme: "[[Anti Money Laundering]]"
Description: Each customer has verified their identity in accordance with applicable legislation.
---

If the filter doesn’t work, let me know if any of the assumptions are wrong.

I got it to work using your filter. Just in case some future person has the same question, I had to add a filter stating that the notes had to be in the measures folder, otherwise I would get a ton of non-related notes.