Working with the Text (vdl-text) Element
Use the Text (vdl-text) element to display values that may change at any time. Such values may be model entity values, view globals or the result of script calculations, or any combination of these.
To add text to the View:
- In the View Designer, open the Palette > Components group, then click and drag a Text element onto the artboard. The Text wizard is displayed.
- The text wizard enables the quick entry of simple text or existing values. If you select multiple options the text fields are concatenated. There are several standard options:
Item Description Add static text Text added to the upper window is displayed as entered Add a parameter The value associated with the entered parameter is displayed Add static text with a dynamic value Template text to demonstrate how to concatenate static and dynamic text Add the number formatted value of a scalar Template text to demonstrate how to apply formatting to a scalar value Add scenario name Text option frequently used when looping through all scenarios on the shelf Add the value of an array element Text option frequently used when looping through all values in an array Add the label of a set element Text option frequently used when looping through all values in a set Add logged in user's full name The currently logged in user's full name is displayed - If the text requires evaluation, select the Dynamic expression check box in the top right hand corner of the wizard.
- Click FINISH to add the text element to the artboard.
You can also edit the Text attribute in the Attributes pane to assign a value.
For example, to display the number of scenarios on the shelf:
View Designer
Open the Palette > Components group, then click and drag a Text element onto the artboard. In the Text wizard, type "=scenarios.length" in the upper text field, and select the Dynamic expression check box. Click FINISH.
Code editor
<span vdl-text="=scenarios.length"></span>vdl-text accepts any valid VDL 4.7 expression and always attempts to display a sensible text representation of the expression's returned value.
A simple fixed calculation:
View Designer

Fixed Calculation in a Text element in the View Designer
Code editor
<span vdl-text="=99 * 88 + 77"></span>
The value of a scalar entity:
<span vdl-text="=scenario.entities.strsclr.value"></span>A combination of strings, a scalar value and a single element of an array entity:
<span vdl-text="= 'This value: ' + scenario.entities.strsclr.value + ' and that: ' + (scenario.entities.RET(2) ? scenario.entities.CAP(2).value : '')"> </span>