Tinderbox Forum

Parent sends an attribute value to child which may change it - getting that value back to parent?

Hypothetical situation: A note used as a container and representing a Person. One key attribute is “rating” which is initially set to 0 and its action sets any child to the same value.

Inside a Person is the child, “Rating”. This also has “rating” as a key attribute. This child contains notes that help the user determine a rating for the person. Now I could go back to the parent (a Person) and enter a revised rating there, but I’d like to enter the rating in the “Rating” note and have that value update the Person’s “rating” attribute.

I’d like to know if a parent and child node, each having their own rating attribute , can keep the corresponding attributes “in sync”. I.E. changing one changes the other. If I can’t do this, is there another setup that accomplishes the same thing?

There is no formalised synchronisation of the type you describe. You can use action code in various contexts and speed of repetition (rules, edicts, stamps, agent actions). However avoid both parent and child both updating the other based on testing the for a difference in value lest you create a looping effect, i.e. parent change child changes parent etc.

So, let’s take your $Rating attribute and make the child update its parent:

$Rating(parent)=$Rating;

I’d use an edict or a low-priority setting agent. A normal priority agent or rules would be testing all the time and more than needed. As a change to a Key Attribute values causes note’s $Edict to run once that may be the optimum. Of course, if you now change the parent value’s in the parent note, it will get set back to the child note. So for the above you need to set $Rating in the child, but i think that is what you want.

Got it, thanks!

1 Like