Using Export codes in Actions (DEPRECATED)

Tinderbox Icon

This pages describes features, codes or syntax whose use is now DEPRECATED, i.e. not advised either for new or continued pre-existing use.

Deprecated aspects of Tinderbox may be supported on a legacy basis but the latter support can't be presumed to be indefinite. Therefore you should update your active TBX documents to latest practice as soon as practical.


DEPRECATED USAGE

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") 



[Last updated: 6 Feb 2012, using v5.10.1]

Google search aTbRef for:  

Creative Commons Licence

aTbRef by Mark Anderson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
[See aTbRef CC licence Attribution & Waiver info]

Made with Tinderbox

Up: Actions