Tinderbox Forum

Problem with "linkPath"

I have difficulty with the linkPath function. Following examples in aTbRef
$MyList = linkPath("*"); → works fine, producing a list of paths
$MyList = linkPath(“agree”); → works fine and list path having links with the type “agree”
In aTbRef there is also $MyList = linkPath(“example”); stating it will list all notes on the path “example”:

I have a container “Container” containing two notes, Note 1 and Note 2. Note 1 links to Note 2.
My assumption was that saying $MyList = linkPath(“Container”); or possibly $MyList = linkPath("/Container"); would result in a list of the notes inside the container, but the respons is an empty list.

Appreciate all help here.

No, it is a list of those notes that have an in- and/or out-bound link of _link type ‘example’. The aim of the operator is to extract a list of all notes attached to/from by links of a specific link type.

Does that help?

Thank you for quick answer.
I think I understand but I find the text in aTbRef slightly misleading in my view.
Could the text "For example, to collect all notes on the path "example: " in aTbRef possibly be changed to "For example, to collect all notes on the linkpath “example”: "

One more on the subject of “linkPath”. Has this function changed during the evolution of Tinderbox, eg from early release 8 to release 9. Particularly, has it been possible in earlier versions of Tinderbox to specify “linkPath(path to Note)” and get a list of all notes with links from this position.

I think what is not understood is that the container is not creating a “linkPath” as notes in a container or not necessarily linked. The key is to first create your link types, then link your notes, then apply your linkPath.

Create linkTypes here (you can also create them on the fly with action code, see below).

Check ou the the following posts and videos, they may help:

But that doesn’t help as there is no formal meaning for ‘link path’ and isn’t particularly understandable English. The article starts:

These functions return a list of notes that are on a designated path.

Peeling away the misunderstanding, perhaps the problem is that the term ‘path’ is insufficiently explained. On reflection (as aTbRef’s author), this might be a better solution to add a note explaining a ‘path’. A path for link type ‘X’ being notes connected to (regardless of direction) by links of a given link type. I’d also need to address the edge case where within the document there are multiple but disjoint ‘X’ networks.

In short, No! The linkPath() operator was only added in v9.0.0 so i suspect you are confusing it with some other operator.

As documented, linkPath() has one required parameter: pathName. A wildcard * value is allowed but normally the expectation is that pathName holds the name of a specific link type.

This is why I’m a bit confused as to why the existing description is not clear. I’m happy to improve my notes, but I need to understand the treason/need for the change. At present, I’m a bit lost, without in any way assuming I’m right or wrong :slight_smile: .

Thanks for your answer.
Yes, I totally agree to a definition of ‘path’, since the term can be used eg /Note to indicate a top note or a ‘link’ to the top node.
The Tinderbox ‘Command & Info’ list as

and to me it was not obvious that pathName was a link.
I don’t know when v9.0.0 was released, I have been reading code provided to this forum that was posted Jan 3, 2018, and this code used the linkPath function. This was the reason behind my question. My assumption from this code was that is was a working copy and that the code was correct. Going over the code I first found the use of the ‘.json’ function and found that this call was deprecated and replace with the ‘jsonEncode()’ function. When I found out that the linkPath did not work as used in the code my assumption was that also this function might have been changed.
So that is the story behind all this.
Again, thank for your answer.

1 Like

It isn’t! It is a subset of all links as scoped by use of a link type. I’d suggest re-reading info on link types as I think this is where you are getting lost.

Tip: don’t think of link types as ‘line labels’ as they may appear in casual map use. In hypertextual terms, the link type explains why the link exists. Put another way, in the context above it is a semantic value and a simple UI label.

In which case please provide a link to the code to which you refer (there is lots of forum data, so it’s hard to guess). Please understand, I’m not arguing, but just tying to place facts under (mis-)assumptions.

Do you have a TBX that shows the problems? I’ll admit I’m beginning to get a bit lost, beyond the fact you are getting results you don’t expect. Links to references and a TBX as a common point of reference would help.

All this comes from the posts on “Publish from Tinderbox to DEVONthink” started by Pat Maddox. He have published several tbx-files and they are also available on his GitHub-page.
The code that have caused problems has been moved between versions from original version where it was in a Stamp action to, in the last version, being placed in an action-note ‘Publish single note to DEVONthink’
Regarding your last sentence, please remember I am way over my head in this, being a beginner TBX user, all this may boil down to me learning and you spending time on a hopeless case.

“Publish from Tinderbox to DEVONthink”. That’s not a thread I know well (as I don’t use DEVONthink enough to know it well) and doing a search on the thread, I find only a single reference to ‘linkPath’ and it is thin this post.

Tip: at the bottom of each post in a thread is a symbol like this:

Problem with "linkPath" - Q & A - getting started with Tinderbox - Tinderbox Forum 2022-01-09 21-34-15

Click that and a pop-up shows a link to that post , pre-selected for easy copy-paste to make a reference link as I did above. FIWI, this is found in all Discourse-based forums.

In that post is included this code, which explains the confusion:

    var linkPath($HTMLExportPath(l));

The immediate giveaway is the first line starting var, indicating a variable is being defined, called ‘linkPath’. As that now clashes with the linkPath operator added later in v9.0.0, how the old code would work in v9.0.0+ is uncertain as it is creating a name collision by trying to make a variable name that is already used by a build-in operator. On fairness, when the old code was written in 2018, such a potential name close did not occur.

This is timely occasion to flag up why I use prefixes for variables and loop variable - i.e. where the user gets to name the operator. That’s not because I’m smart, just cautious. In the above scenario, I would have named the variable vLinkPath so even today the code would work. Plus, reviewing the code years later I’d know the tern was a variable due to the ‘v’ prefix to a CamelCase word.

Another learning point here is the problem of action code in very long-lived threads—or very old ones found by search; action code has come a long way since its debut back in 2001! For all but simple issue there is a chance of later changes, so do follow through the thread to look for corrections. That would have shown the demo TBX has been updated several times and version 0.5.4 was offered in this post in December 2020.

Interestingly the version 0.5.4 TBX file, can be seen that ‘linkPath’ was being used in a note called “Publish single note to DEVONthink”, which is problematic and should likely be fixed.

As to your last point, the above project is quite complex an ideal starter project. I quite appreciate you want to do things with DEVONthink, but you might find it helpful to try some simpler projects and read the available docs and tutorials and actions before using more complex projects.

HTH :slight_smile:

Thanks again for all help.
I have “fixed” the code and submitted it to the forum. This new version correctly copy Tinderbox notes to DEVONthink and, as far as I know, even the links are preserved. There may still be cases where the tbx-file fails, but I reached my goal to get this tbx-file working on Tinderbox v9.1.


Glad to hear it is now working and thanks for reporting back the successful result.