Tinderbox Forum

Copy value for Displayed Attributes of parent note

Wondering how to copy the Displayed Attributes of a parent note to a particular child note. I got this far after reading various sources but no joy:

$MyList=$DisplayedAttributes(parent);
$MyList.each(dattr){action("$"+dattr(this)+"=$"+dattr(parent));};

$MyList does what is is supposed to but the combination of the loop and action don’t. Help appreciated.

There are a number of ways to do this.

  1. Use a prototype, assign a prototype of the child notes
  2. Use action code in a stamp $DisplayedAttributes=$DisplayedAttributes(parent);
  3. Manually do this through the action inspector
    image

Select the parent, copy the value, and then select the child and paste the values.

The solution you pick all depends on the context of your activity, i.e., is this a one-and-done effort or something you’ll do a lot.

1 Like

Thanks @satikusala. Silly me - I forgot that DisplayedAttributes is itself an attribute that can be copied to the child note.

Let’s say I want the first 5 Displayed Attributes copied however? I’d still be interested in knowing what mistakes I made in my initial solution to address the more general case in which I have a list of attributes from the parent note which I would like to copy to its child.

Your above code is creating a list of referenceable attributes by putting the $ to the list of attribute notes in the displayed attributes. If you’re looking to simply grave just a few of parents’ attributes, then you can simply type in the names in $DisplayedAttributes without the $. If this is something you’ll be doing a lot, there are alternative ways. I’d need to understand your context to propose other methods.