This version is out of date, covering development from v8.0.0 to v8.x.x. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v8 Icon

Getting section number via Action code

Export code includes a code ^sectionNumber^ which gives output like this 1.18.35. It is effectively a chaining off all the $SiblingOrder values for ancestors and that of the current note.

This can be achieved in action code but is somewhat inelegant as root level notes require a different handling and action code conditionals require a full expression inside the branch. This to set $MyString to the section number use:

$MyString = if($OutlineDepth >1){
   collect(ancestor,$SiblingOrder).reverse.format(".")+"."+$SiblingOrder;
}else{
   $SiblingOrder
};

Or, in one-line form:

$MyString = if($OutlineDepth >1){collect(ancestor,$SiblingOrder).reverse.format(".")+"."+$SiblingOrder;}else{$SiblingOrder};


A Tinderbox Reference File : Actions & Rules : Getting section number via Action code