Creating Function Templates

STEP includes default function templates, which appear when 'Insert Template' is clicked on, but STEP also allows you to create your own.

User-defined function templates are stored in the directory identified by the 'Calculated.TemplateRoot' system property in the sharedconfig.properties file. The directory is on the application server, or when using a clustered setup, on a shared drive. For example, on a Linux system, the property could look like this:

Calculated.TemplateRoot=/shared/calculated-templates

For Windows, the folder is normally found in a drive with the path similar to below:

E:\stibo\step\calculated-templates

Note: The name of the drive that the path is found in may vary from system to system. In this example the drive 'E' was used.

The following images show the relationship between the folder / file levels and the information displayed in the Insert Template dialog. Within the function template directory, create as many levels with corresponding descriptions as needed.

  • To add a new level in the Insert Template dialog tree, create a new directory below the root, such as 'Object Maintenance Templates.'
  • To display a Description for a directory in the Insert Template dialog, create a file named 'info' in the directory, and include the description text in it, such as 'Function Templates for Object Maintenance'.

The following images show the relationship between the template file and the information displayed in the Insert Template dialog. Within the function template directory, create a template file as follows:

  • The name of the template file appears in the Insert Template dialog tree. For example, 'Get name of current object'.
  • To display a Description for the template file, start a line with a number sign (#) and add description text. For example, 'Function for getting NAME of current object'.
  • To add the function within the template, start on a new line. The function displays in the Template area of the Insert Template dialog. For example, 'stepname()'.

The following image shows the template setup and details in the Insert Template dialog.