action(code)

Tinderbox Icon


Operator Type:   Function
Operator Scope of Action:   Item
Operator Purpose:   Data manipulation

action(code)

New to v5.8.0, this function allows execution of code without the need for a return value. This lets an action in an attribute, $Text being useful for long complex actions, and perform that action as part of a rule or agent action.

For example, the Rule

action('$Color= "bright red"')

will set the note's primary color ($Color).

Note that that in its simplest form, an action() call is a quote-enclosed string. As action codes tend to use double-quoted strings, it may often be necessary to use single quotes for the outer enclosure, as in the example above.

The action function returns nothing (actually an empty string), so there is no requirement for a left-side attribute to accept any output. By comparison, the related eval(expression) function evaluates an expression and returns a value. Whereas eval() is designed to return an output, action() performs an action such as an assignment.

An action() call can be used with do(macro) to create a form of function as macros allow input parameters (its arguments) - see do().


Possible relevant notes (via "Similar Notes" feature):

Up: Item-based operators

A Tinderbox Reference File : Actions & Rules : Operators : Action Operator Scope : Item-based operators : action(code)

Quicklinks: Attributes | Action Codes | Export Codes | Designators | Date Formats | aTbRef Site Map

[Last updated: 16 May 2012, using v5.11.1]


Search:

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