Export Code Type:
Export Code Scope of Action:
Export Code First Added:
Export Code in Current Baseline:
Export Code Last Altered:
Calculation [other codes of this type]
n/a [codes with similar scope]
v4.0.0
Baseline
As at baseline
^action( action )^
This code performs any action, or list of actions, that could be performed by an agent or rule. For simplicity, consider it as if it were a rule that is only run when a note is exported using the template holding the ^action()^ code.
The action code in the action parameter is performed immediately. ^action()^ does not export anything itself. For example, to make a note with $Color of 'blue' change to 'red' if exported:
^action($Color="red")^
will change the colour of the exported note to red. Note that the change of $Color made by the code above is permanent, i.e. it is now 'red' until changed otherwise.
However, this operator allows manipulations for export use without needing, for instance, to hold the value in a user attribute first. Since action code added variables, a common use of ^action()^ if to read an attribute value and store a changed value in a variable that is then used in the exported 'text' of the output page.
Also see, action(), ^value( expression )^.
The internal equivalent is a normal action/rule statement, i.e. where is no point in using ^action^ internally. However, if you want some logic during export to change an internal attribute value (e.g. exported notes having a new colour), then use ^action^ in the context of your export codes.
IMPORTANT: if using ^action()^ in the text of an exporting note (i.e. in $Text), remove all line breaks in the enclosed action code. Otherwise a mis-evaluation will occur as each code line will be treated as an HTML paragraph enclosed in <p></p>
tags.
See also—notes linking to here: