This version is out of date, covering development from v7.0.0 to v7.5.6. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox 7 Icon

Using attributes as global variables/constants

It may be useful to store a snippet of information, such as the local sales tax percentage or the name of a certain project in a manner such as lets any note read or set that value. In programming this method is often known a a constant or global variable.

This is slightly different to setting an attribute default value whereby all attributes start with the same value. Using the local sales tax example above, it might be necessary to have a value of 0.05 (5%) that can then be used by any action code trying to figure a true sales total.

This simplest method to do this is to simply place the value in an attribute (of suitable data type) in a note outside the main content. Because it is an attribute you can both fetch the value and (re-)set it. Things to consider:



A Tinderbox Reference File : Attributes : Using attributes as global variables/constants