Tinderbox Forum

How can make an attribute inherit its value from a parent when this isn't a prototype?

Another probably newbie question I can’t find tease an answer to from the documentation. How can I get a key attribute in a child note to inherit a value from its parent without the latter being a prototype? For example, I’m making a list of films each item of which is a container including research notes about the film. Each parent note is named after a film and is based on a prototype which includes key attributes for other info such as the year the film was made, the country it was made in, where copies are held, etc. The child notes contain other info and thoughts gathered while viewing and researching the film. They follow a different prototype, only some of whose key attributes are the same as the parent’s, but I want the ones that are the same to inherit the parent’s value (e.g. film name, year, etc). This is so I can use agents to group the children later away from their parents according to shared features without losing track of which films they refer to. What I want is for each child note to be automatically populated with these shared parent values as I add it, without having to go through the tribulation of making each parent note a new prototype.

I hope this is clear. The answer is probably obvious enough, but I’m not there enough yet…

If your attribute is $myAttribute then set $Rule for the children to


Or you can do this in an $Edict or a Stamp, etc.

I think this would do what you want:

  • Have a prototype for all the child notes, whose values you want to populate from the parents’ values. Let’s say this prototype is called *ChildNote (For convenience, I name prototypes with an initial *)
  • Create either a Rule or an Edict for this prototype, on the following model: $FilmName=$FilmName(parent) . That will automatically populate the attributes in the child note with the values from the parent.
  • You can automate the assignment of prototypes by creating an On-Add Action, for the parent-note containers. The action would be on the model of *$Prototype="ChildNote" . So as you create each new note in that container, it will take on the *ChildNote prototype.

Update I see that @PaulWalters has a terser version of this advice!

I do book and film notes like what you describe all the time and use OnAdd actions to set things like $title, $author, and $prototype when I move a note to (or create a note in) a container. In a lot of cases, I set the on add actions of the containers using a prototype.

If you wanted to set info using a rule like the one Paul suggests you could even use OnAdd actions to let the container assign the rule to children.

1 Like

Many thanks all, and for such prompt replies. An exemplary community! I’m pleased to say I had almost worked it out, with one error which you have now corrected for me, so am chuffed to find I’m cracking the syntax. Thanks again.