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 : Actions & Rules | aTbRef Site Map |
Actions & Rules |
An action is an automatic way of setting a certain attribute to a certain value. In the context of this section, Rules should regarded as synonymous as they differ only in the scope of action.
Agents can have actions. An agent performs its action on all the notes it finds that match its agent query.
Notes can have actions. A note performs its action on all its children — but not on the children's children, i.e. descendants. A Rule is a special sort of note action whose effect is applied only to the note and not any children. To effect both the note and children, the same code can be added as both and action and a rule.
Actions and rules may use simple arithmetic and logical expressions.
$Width=5+2;
$Width=$Height(parent)*1.5;
$Urgent= (Overdue | Essential);
$Width =($Width(/Configuration)+1)*$Scale;
Because Tinderbox recognises operators such as + and -, notes whose names begin with characters other than letters and numbers may sometimes be interpreted in unexpected ways. For example, if a note is named "6*7", rules like
$Prototype=6*7
...might be parsed as a multiplication with the result of 42.
$Prototype="6*7"
...should have the expected effect.
Actions and rules may use computation with data attributes - including attribute value from other notes. For example:
$DueDate=$DueDate(parent)+7 days;
$DueDate=$ExpiryDate(parent)-10 days;
Date attribute values can also be computed with literal dates:
$DueDate=November 15, 2004 + 7 weeks
With the expansion of action code in v4.0+, use of export codes is deprecated were action code alternatives exist. Existing users with legacy TBX files may find it worthwhile to review and update their actions written pre-v4 to use the newer syntax. It is also a good rule of thumb that post-v4.0 all string literals (actual pieces of text - not placeholders, attribute names, etc.) should be placed in double-quotes whenever used in code.
Up: A Tinderbox Reference File | |
Previous: Agent Queries | Next: Export Codes |
Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]