Skip to content
QiTASC.com / intaQt Built-ins /
Template Built-ins
/ .. /
Template Built-ins





Template Built-ins

Template Built-ins enable generating text output to intaQt Steps language, based on templates and changing data. Two functions are available:

  • Create the template from string or file.

  • Process the data model containing the missing values to the template, and replace the template tags with missing values.

Templates are written in the FreeMarker Template Language (FTL), and text output may include HTML web pages, E-mails, configuration files and source code. The result may be stored in separate files, strings or as a Context Object.

Template Built-ins are useful, for example, when working with large XML files that have a clear-defined specification. The template enables replacing content with a specified value, which limits the need for dynamically building a complicated new file in Steps.

Create Template from String

Creates the template from text.

Syntax

1
<template Template> := Template.getTemplateFromString(<templateText String>)

Returns

The template instance for specified string.

Parameter

  • templateText - The raw template string

Example

1
template := Template.getTemplateFromString("Welcome ${user}!")

Create Template from File

Creates the template from a file.

Syntax

1
<template Template> := Template.getTemplateFromFile(<templateFile File|String>)

Returns

The template instance for specified file.

Parameter

  • templateFile - The template file or path

Example

1
template := Template.getTemplateFromFile("Users/mycomputer/Desktop/template.txt")

Process the Template

This function feeds the data model containing missing values to the template, then processes the template and replaces tags with values from the data model. The function may specify an optional file, to which the processed result will be stored.

Process Template

Processes the template.

Syntax

1
<result String> := <template Template>.process(<dataModel Map<String, Any>>)

Returns

The string resulting from the template processing.

Parameter

  • dataModel - The map of keys and values that should be used for template substitutions

Example

1
2
template := Template.getTemplateFromString("Welcome ${user}!")
result := template.process({ "user": "QiTASC" })

Process Template to File

Processes the template and specifies the file to which the result is stored.

Syntax

1
<template Template>.process(<dataModel Map<String, Any>>, <file File|String>)

Returns

The string resulting from the template processing.

Parameters

  • dataModel - The map of keys and values that should be used for template substitutions

  • file - The file where the processed result should be stored to

Example

1
2
template := Template.getTemplateFromString("Welcome ${user}!")
template.process({ "user": "QiTASC" }, "template.txt")