How would I find all notes with a specific linkType?

I cannot remember the query I should use to find notes with a specific linkType.

Let’s say the link type that I want to find in my tbx document is “relatedTo” and I cannot find the incoming or outgoing notes, but its somewhere in my document.

How would I find all notes (incoming or outgoing) with a linkType “relatedTo”

Thanks in advance
Tom

Thanks to the wonderful aTBRef I found I can use:

links[(scope)].directionStr.[linkTypeRegex].attributeNameRefStr

Question: I am thinking I need to separately create a query something like:

links.incoming."relatedTo".$Name | links.outgoing."relatedTo".$Name

am i getting warm…

Tom

Yes, insofar as links() can only check in- or out-bound links in a single call. But links() is for making lists.

In an agent query, you probably want to look at linkedTo() and linkedFrom().

If you want to see the network of the “relatedTo” link type don’t overlook hyperbolic view.

i did not think I could use linkedTo() or linkedFrom() because I did not know the name of the source or destination note. Therefore, I was thinking I could only use links.()

Am I wrong? I am currently out of the office, but will check when I return

Tom

But links binds to this, so:

links.incoming."relatedTo".$Name

means the note in current context. Or you can provide a scope:

links("some note".incoming."relatedTo".$Name

agents are doing true/false tests. I tried links() and in an agent, as suspected it fails.

But, this works:

linkedFrom("*", "relatedTo") | linkedTo("*", "relatedTo")

Test file: find-linked-path.tbx (120.3 KB)

2 Likes