Dynamic Text
Overview
Dynamic text is text that includes some type of dynamic logic that gets evaluated when the text is rendered.
This allows the text to be automated in a way that updates itself each time it viewed, or in
response to changes in data that the text is bound to.
Example
The following represents a simple example of dynamic. It includes an expression, {% 2+3 %}, that gets evaulated
when the text is rendered.
The sum and 2 and 3 is {= 2+3 =}
The generated output in your document will be
The sum and 2 and 3 is 5
While this simple example is probably too simple to be useful, the capability of executing embedded scripts
creates the possiblity of computing statistics that can be recomputed as the document gets re-rendered and
the data changes.
The following reads a dataset from the worspace, computes and average value, and then renders that value.
As the data changes in the workspace, the document will render to a new value.
The average price is {= $val('prices').average() =}
Bracketed Expressions
Dynamic text is linked into a document through the use of a set of specified brackets. There are three
different types of bracketed expressions.
- The expression equality bracket - The expression equality bracket : {= =}.
Used to enclose and expression that needs to be evaluated and then inserted into the text
- The procedure bracket - The expression equality bracket : {: :}.
Creates a procedure that is run when it is encountered. The procedure can do many things, including
inserting text into the document.
- The re-evaulate bracket - The expression equality bracket : {! !}.
This bracket is a procedure bracket (see above) but will also re-evaluate the text that the procedure produces.
Demos
Dynamic Text
Shows some basic examples of using dynamic text.