Inserting OTScript Code Blocks

In a template, you can define your own block of OTScript code to retrieve specific data that cannot be accessed directly.

To define your own calculation or accessing code, you can insert a piece of OTScript code, which returns a terminal element to an appropriate structure element. For more information, see Insertion of Elements.

For reusable codes, you can customize the list of data methods by defining persistent methods. For more information, see Coding in OTScript.

See Also
About Structure Elements Tab
Defining OTScript Methods in Templates
About the Creation of Shortcut Methods
  1. From the Structures list:
    1. Drop the Paragraph element into the work area.
    2. Drop an OTScript Code element into the inserted paragraph.
      An OTScript code area is inserted in the paragraph.

    3. Select this code area.
      The Properties tab refreshes.
  2. In the Code field, enter some code returning a terminal element.

    Tips:
    • You can drop an element from the Data tab into the OTScript Code field to directly use its internal name.
    • If the code contains an error, an error icon appears on the OTScript code area in the work area, and a tooltip contains its details.

    Examples:

    • You can enter a string between quotes, for example, "Text".
    • You can drop a data text from the Data tab, for example, req.name.

    The code appears in the OTScript code area.
  3. Optional: To format and filter the element, more options are available in the form. For more information, see Formatting, Filtering, and Sorting Options.