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 : Operators : Action Operator Scope : Item-based operators : eval([item],expression) | aTbRef Site Map |
eval([item],expression) |
Operator Type: | Data manipulation |
Operator Scope of Action: | Item |
The eval() operator takes two quoted evaluated (as string) parameters, i.e. the parameters. The first parameter is optional. Thus, in basic form:
if($MyBool){$AttribX="$Name(parent)"}else{$AttribX="$Name(grandparent)"};$AttribY=eval($AttribX)
will set AttribY to the name of the current name's note or it's grandparent depending on the value of attribute MyBool by evaluating attribute AttribX.
The eval() operator also allows access to two properties that aren't available via action syntax, the current TBX document's filename (sans extension) and app version:
eval(^docTitle^)
- gives a value of "aTbRef47 copy" (note no '.tbx' extension)
eval(^version^)
- gives "5.0" (note - you might want to prefix the return string with 'v' or 'v.' thus: "v.5.0").
In full syntax form, an additional first parameter is added that is an expression string evaluating as a note name, path or note name. Where specified, this indicates the note from which attribute values in the second parameter should be drawn.
Up: Item-based operators | |
Previous: escapeHTML(data) | Next: &= (logical AND) |
Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]