eval()

Tinderbox Icon

The eval() operator takes a single string as an argument and evaluates it. Thus

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 - the current TBX document's filename (sans extension) and app version) - that aren't available via action syntax:

eval(^docTitle^) - gives a value of "aTbRef45a" (note no '.tbx' extension)

eval(^version^) - gives "4.5.4b1" (note - you might want to prefix the return string with 'v' or 'v.' thus: "v.4.5.4b1")


Up: Full Operator List
Previous: escapeHTML("theString")  Next: every() 

[Last updated: 1 Dec 2008]

Google search aTbRef for:  

Licensed under Creative Commons Attribution-Noncommercial-Share Alike 3.0 License
[See aTbRef CC licence Attribution/Waiver info info]

Creative Commons License

Made with Tinderbox