This version is out of date, covering development from v4.6.0 to v4.7.1. It is maintained here only for inbound reference links from elsewhere. Jump to the current version of aTbRef. |
|
A Tinderbox Reference File : Objects & Concepts : Actions : Using Export codes in Actions (deprecated) | aTbRef Site Map |
Using Export codes in Actions (deprecated) |
In general, post v4, using export codes other than in export templates is deprecated. Only two export codes cannot be replicated with action code, ^docTitle^ and ^version^.
In order to make Tinderbox export codes run in actions and rules it may necessary to start the code after the = sign with a caret and a space, e.g. "^ ". This mechanism is not explained in the manual. Note that the template expression begins with a caret (^) followed by a space. For example:
$Name=^ made on ^get(Created,"Y-M-D")^
...sets the name of a note to a formatted date. Now use this, all in action code, instead:
$Name="made on " + format(date($Created),"Y-M-D")
When an opening "" syntax is applied, the first space character is ignored (but subsequent spaces are treated as space characters. This avoids possibly ambiguities where Tinderbox might not know whether you intended the initial word to be a markup token. For example, in
$Name=^ides of march
... Tinderbox would try to evaluate ^ides as a markup expression,
The space is optional and may be omitted in the (common) case where the template expression begins with a command:
$Name=^get(Date)^ jottings
$Name=$Date+" jottings"
Multiple actions may be applied, if separated with semicolons, even if some of them are template expressions.
Note that semicolons may not appear inside a template expression action (since the parser would split the expression at the semicolon. Thus:
$Name=^get(User1)^;$Color="red";
... OK
$Name=^ Sing; Dance
... not what you expect
In the second example, the name of the note is set to Sing, and the stamp named 'Dance' is then applied to the note. Now, in v4.6+ use this instead:
$Name=$User1;$Color=="red";
... OK
$Name="Sing"; Dance;
... either
$Name="Sing; Dance";
... or
To set multiple Key Attributes in a multiple action, place the attributes string in quotes:
"$KeyAttributes=Name;OutlineOrder";$Name=^ made on ^Get(Created,"Y-M-D")
Now use:
"$KeyAttributes="Name;OutlineOrder";$Name="made on "+format(date($Created),"Y-M-D")
Up: Actions |
Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]