Tinderbox Forum

Inherit Attribute from Parent if not blank

Hello everyone,

I created a Prototype with various On Add actions set to inherit the Attribute of the parent note, something like this:


I have a “Literature” container that uses that Prototype. Thus, each new note that is moved inside of it inherits these attributes.

My question is, how can I change the Action to inherit the value ONLY if the Attribute of the note I am moving inside the container is blank?

For example, I have a note somewhere else in the map with a preset Author value. I would like to keep the Author’s name when I move the note inside the container with the On Add action.



I think you need to use the |= operator instead of =. Essentially the logic of the former is as you describe. I’d put in an aTbRef link if i didn’t have the site in maintenance just know.

If in doubt about using, make a small test TBX - you’ll only need five or six notes to test: a prototype, the container and a note with and without $Authors data.

Try this action


(Hat tip to @mwra for editing this with correct equivalence syntax :slight_smile: )

I’ve made a demo of both the |= and the if methods. They both have the same outcome. @PaulWalters if method is easier to follow for the novice. Seeing seeing both methods together may remind us (me included) about the |= operator which is easily overlooked by those of us not steeped in logic syntax. :slight_smile:

Conditional-add.tbx (85.4 KB)

1 Like

The |= operator is one of my favorite commands within Tinderbox. It has the multiple virtues of:

  • allowing you to streamline operations when usually a certain value or categorization will apply [like, $StartDate|=date(today) , which will set the $StartDate to today’s date, unless you’ve already set it to something different–or until you manually change it to something else];
  • letting you manually re-set any values that differ from that general pattern [like, $StartDate="August 1, 2020"]
  • providing protection from the program over-writing or undoing those custom values. If TB sees that you’ve already set a value, it won’t go in unbidden and change things around.

Realize that @mwra and @PaulWalters are well aware of this, just spelling it out in answer to original query.

1 Like

No, happiness here. It’s one of those things that just looks bizarre until after the fact.

(Did your bullet 2 mean to use |= or =?)

Hi Mark, should have clarified – the second bullet point is how you would re-set the value, manually, either (a) before the |= operation ran, to prevent it from setting the date to “today,” or (b) after that operator had run, to change it to your preferred date.

1 Like

Hello, @mwra et al.,

This is brilliant. The |= operator works precisely as I intended. Thank you very much for your support.

I also like to say that the bidirectional linking (Zip Links) in TB 8.6+ has increased my use of TB 10 fold.