Creating a "summary" stamp (collecting $Text from all notes descending from its parent)


(Bruno Moreira) #1

Hi. This seems simple, but I can’t seem to get the grasp of it.
I’m trying to create a “summary stamp”. When executed on a “Summary” note, that note’s $Text should become the concatenation of the $Text of all notes descending from its parent.

Eg. with this outline:

--Chapter A (text: "First Chapter")
--Chapter B (text: "Second Chapter")
----Text B1 (text: "Lorem")
----Text B2 (text: "Ipsum")
----Summary (text: to be defined by the stamp);

when applying the stamp to “Summary”, it’s $Text should become:

Second Chapter
Lorem
Ipsum

I can’t seem to get the find / descended from query work. I’m using this but I don’t get a consistent result:

$Text=;
$Text = format(collect_if(find(descendedFrom(parent)), !$IsAlias, $Text),"\n\n")

but replacing “parent” by the actual name does work:

$Text =;
$Text = format(collect_if(find(descendedFrom("Second Chapter")), !$IsAlias, $Text),"\n\n")

Any insights?
Thank you!


(eastgate) #2

As I recall, inside the find() statement, this is the note being tested; everything is descended from its parent, except that top-level notes don’t have a parent and aren’t.

I wonder if export might be a better solution to your problem? Also, some features of the next release may help with this as well.


(Bruno Moreira) #3

Hmm I was thinking of this more like a “summary-in-progress”, i.e., not meant to export to other application, but to keep working within Tinderbox.
If you’re familiar with Scrivener, I was trying to get something like “scrivenings mode” - view all text descending from a particularly selected group.


(Bruno Moreira) #4

Would still like to know if there’s a solution, for “educational purposes”. But found a much more simpler way to do it by using the stamp rule

$Text=format(collect(descendants,$Text),"\n\n");

on the “Chapter B” note. Makes much more sense…


(eastgate) #5

I think rather than “parent”, you wanted find(descendedFrom(parent(that)))…


(Mark Anderson) #6

Busy on a submission deadline, but this and this might help fill some gaps.


(Bruno Moreira) #7

Thanks. I really need to learn “that” better :sweat_smile: