Stamp to select all notes linked to the stamped note?

Dear TB Forum friends,
I wonder if anyone know if it is possible to make a stamp that selects all notes directly linked to the stamped note in map view? To select all linked notes, I currently jump to outline view and filter using linkedTo(“name of note”) and then go back to map view, but it would be great if I could skip the view-hopping and typing. Is such a stamp possible? Other clever ways to select all linked notes?

Thanks in advace!

Best wishes,
Per

Yes, see links(). This stamp works for me:

var:set vSet = links.inbound..$Name;
select(vSet);

We use a Set-type to make the list of items to select as we only need to select each linked item once regardless of the number of times it is linked to the stamped note.

Be aware links() only evaluates inbound or outbound links. If you need to select both directions then use links twice and use the combined result:

var:set vSet = links.inbound..$Name;
vSet += (links.outbound..$Name);
select(vSet);

Note that links evaluates to a scope of links(this). But, links() evaluates to … nothing, so avoid that form if testing links to the current note.

My test doc: links-in.tbx (188.3 KB). Use the two test stamps on note at path `/test/

1 Like

Thanks Mark! It works like a charm! I would never have managed to figure that one out.

The only issue I found was that some notes with quotation marks ("") in the name were not selected, but I am now aware the odd challenges with that and on a quest to rid the names of quotation marks.

Thanks again!

Best wishes,
Per

Please excuse my tweak to your posts text (via my admin access) but Markdown ‘corrects’ straight quotes to typographic (‘curly’) ones. As I suspected, you’d typed straight quotes. Anyway…

Yes this is a known issue, and under active resolution. Not easy work, if I understand correctly, as surgery is need in the deeper parts of the app. But, the issue is known and hopefully a fix is on its way in the future.

As at v10.1.2, see Problematic Characters for Action code in $Name and $Path. Fixes are under test for some of the problem characters but quotes are still a challenge. IOW is an " the start of a string value or a literal double quote. Once you are trying to generate valid HTML that must use double-quote enclosed, fun ensues.

For now if you need double quotes in a $Name, consider using actual typographic quotes i.e.“ or ” and not ". Ack, hard to see with the render here. The open/close typographic quotes can be inserted using ⌥[ (open) and ⌥⇧] (close) … at least, on my UK keyboard. I think US key mapping is the same, not sure about other layouts. Likely there is a shortcut in other language keyboard mappings but possibly using different keys.

I see. Also notes with names containing semicolon (;) are not selected. I really need to learn not to use certain typographical symbols and punctuation marks in the titles.

It’s hard. I first discovered these issues as my work had me working on Computer Science papers. Their titles included lots of characters that are also regex special characters, so ‘just’ using the actual title for $Name was … problematic.

Remember too, Tinderbox stretches back pre OS X. On the old Mac a colon was the folder delimiter in a part. Now macOS uses a forward slash. Both are characters that are normal to use in the ‘text’ of a note’s title but which can confuse Tinderbox under the hood.

My aTbref notes on this (link in my last post) are probably over-conservative. But deliberately so. It depends how much you ‘need’ a particular character in a name vs. not having to think of its effects.

HTH

Yes, it really helps. Thank you for both providing a solution to my query and for always taking the time to also explain in a way so even I understand.

1 Like

Many of these gotchas will be removed shortly. I believe we now have everything solved with the exception of double-quotes.

3 Likes