Tinderbox v10 Icon

ancestors

The designator ancestors returns a List of all notes in a direct line of ascent from the current note to its root-level container and so the List is returned in descending $OutlineOrder.

As the list of ancestors is returned in reverse order, i.e. deepest nested first and root item last. So:

$MyString = collect(ancestors,$Path)[-1]; is the root-level container for this note
$MyString = collect(ancestors,$Path)[0]; is the parent container for this note

See also—notes linking to here: