Notes not inheriting a function call from the prototype

I have two small functions in the Hints-Library container and they are called through Rules in a prototype:



This text will be hidden

I added the first function call to the prototype and it worked as intended on the 150 notes that have this prototype.
But when I added the second function call to the prototype, nothing happened to the existing notes.

The container for these notes assigns the prototype through OnAdd and both function calls worked on any new notes. But not on the pre-existing ones.

I used a Quick Stamp to reset the prototype on the notes


But that didn’t work. The Inspector continued to show that the notes were calling just one of the functions.

Whereas the prototype contained both function calls as did the newer notes.

In the end, I added $Rule to $DisplayedAttributes and used a Quick Stamp on the notes to set $Rule to “none” and then set $Rule to the default for these notes’ prototype.
And then it worked.

By this time, my relationship with Tinderbox was somewhat strained, and so I had to go out for a couple of strong Italian coffees at my favourite bar (I live in the working class/migrant part of Nuremberg, so the coffee is very strong).

OnAdd runs once when a note is added. Thus if you alter a container’s $OnAdd code, it has no effect on existing child notes! To resolve this do any one of these:

  • In outline select the pre-existing children and do Shift+Tab then Tab. That promotes the children out of the container before re-inserting them and in so doing, firing the OnAdd on them.
  • Select the pre-existing child notes and run the new OnAdd code on them via a stamp or quickstamp.

OnAdd is not like an AgentAction that fires every time the agent updates. Originally, that meant recreating all the aliases anew and as such they were ‘added’ anew to the agent, so it works like an OnAdd. But, for efficiency, when an agent updates it actually retains aliases that still match the query. So, although not re-added, the agent action run on them again as if they were newly added.

I’d be interested to know what made you think an OnAdd would run on existing children as such guidance is inaccurate and probably needs correcting/updating.

1 Like