Since v4 guidance is to shift to export attribute values using ^value($Attribute)^ rather than ^get(Attribute)^ and ^value($Attribute(Some note))^ rather than ^getFor(Some note, Attribute)^. The previous ^get^ and ^getFor^ are deprecated.
Do be aware that to get the expected value in the exported data some attribute data types, especially Date and Color require the attribute value to be enclosed in a format call:
^value($AccentColor)^
: dark warm gray dark
^value($AccentColor.format())^
: #403a35
^value($Created,"*")^
: 2010-01-06T09:46:17+00:00
^value($Created.format("*"))^
: Wed, 6 Jan 2010 09:46:17 +0000
An added advantage of the ^value^ method is that the exported value is an evaluated expression so it is possible to manipulate attribute data. If $MyNumber is 5:
^value($MyNumber)^
: 5
^value($MyNumber*3)^
: 15
Note that the evaluated result is only seen in the exported code; the source attribute(s) are not affected.
Compared to old methods like ^text^ and ^title^, ^value^ does not evaluate any inline ^ export code in $Text or $Name; for instance macros, linkTo and include codes. In such context, trying ^value(eval($Text))^ does not help as eval() evaluates action code rather than export code.
Referencing a template's attributes. Unlike all other notes, in an export template (i.e. $IsTemplate is true
), referencing an attribute refers to the note being processed and not the template. To refer to the template is its path or name, thus $AttrName(template-name) not $AttrName.