Tinderbox Forum

Child to Inherit Parent Name

  • I’d like to my child note to display it’s title+parent name , so if my parent name is
    Project A , if my child name is Meeting with B , it should become Project A - Meeting with B

I tried this as manual action , it works but as an action it doesn’t

$DisplayExpression=$Name + $Name(parent)

If setting $DisplayExpression via an action, you want to set the code to be evaluated. Your example

$DisplayExpression=$Name + $Name(parent);

set the $DisplayExpression to the String value result of that code “Meeting with BProject A”. The correct method is:

$DisplayExpression="$Name + $Name(parent)";

If you look at the Display Expression in the text Inspector you see this:

IOW, you’re seeing what is inside the quotes in action above.

Having fixed that let’s fix the actual expression:

$DisplayExpression='$Name(parent) + " - " + $Name';

which makes $DisplayName (the screen label derived from evaluation $DisplayExpression) “Project A - Meeting with B”

Note: because the ‘code’ of the Display Expression uses quotes we must use a different quote type for the action. Here I’ve used double quotes in the code and single to wrap the codes. You could do the reverse. It doesn’t matter as long as one type is nested by the other.


Question, do you literately want the child name to be “Project A- Meeting with B” or do you want the display expression to be this? Those or two totally different actions and in practice mean different things. Display Expression will not change the note’s actually name, just how it is visually presented, the note’s actually name will still be whatever you gave it.

I suspect what you’ll want to do is to an Edict that will update the Child name, you might try:

$Name=$Name(parent)+" - "+$Name.

Note, however, while this is a convenience for the name, it won’t help you with searches and organizing all the related notes to the parent. You could create an attribute, say $Project, and then do this:

$Name=$Name(parent)+" - "+$Name;$Project=$Name(parent);

Now you have the name that you can track against and an attribute that will also help you associate this note with the respective project.

There is a lot of other logic that you could wrap around this.

Dear Micheal and Mark,

Thanks for the detailed reply

  • Amongst many thing I was goofing was trying to put the Action on the child itself while testing , I now realise I should have only put it on the child
  • Thanks for the screenshots Mark , I never figured that text inspector has Display Expression setting inside
  • Escaping the quote is something in this.
  • Edict was useful in this to update the child name indeed
  • I ended up storing the project name in an attribute (which is helpful in searches indeed)