More about text scripts
Object-to-String scripting is quite flexible when working with BoundLabel widgets. You are limited only by your understanding of Baja (see online Bajadoc in the Help system).
For the non-developer, these few simple rules may help:
- The BoundLabel widget must actually be bound to an object (using an ord). In other words, you cannot simply drag a BoundLabel from the kitPx palette to the Px page, edit the Text Format property, and get results. If needed, the BFormat script you use may be totally unrelated to the bound object. For example, you can bind to any object and enter a system-type call, as shown here:
%time().toDateString% to produce text like “01-Nov-08” Relative to the bound object, you can use the parent technique to “walk up” the component tree of the text for a slot (or name), for example:
%parent.parent.name%gives the name of the parent two levels up.For example, a BoundLabel bound to a DiscreteTotalizerExt under a BooleanPoint, where you wish to display the (parent) point’s name and the number of times it has changed state since its last reset, could be achieved using this Text script:%parent.displayName% had %changeOfStateCount% COS since last reset.The result might be: ChWPump2 had 14 COS since last reset..
In addition, relative to the bound object, you can also “walk down” the tree in a parallel path, using the slot name (versus name or displayName).
An example of this “walk down” method (via slot name) is in the history extension (historyName) example, along with the parent technique.