How to update progress bar in real-time when adding child notes?

I am trying to create a progress bar in Tinderbox that reflects the ratio of the number of child notes under the current note to a target number. I have set a $MyNumber attribute to store this ratio, and I use this attribute to set $Pattern to “bar”, so a progress bar will be displayed on the note in Map View.

Here is the code I am using:

var vProgress = count(children);
var vTarget = 10; // my target note count
$MyNumber = vProgress/vTarget;
$Pattern = "bar("+ ($MyNumber * 100).format(2) +")";

However, I find that when I add new child notes, the value of $MyNumber does not update immediately, and the length of the progress bar does not change. What I want to achieve is that every time I add a new child note, the value of $MyNumber and the length of the progress bar can be updated immediately to reflect the new number of child notes.

thank you

The upcoming release adds a command to do this. Soon!

1 Like