Relatics offers a powerful syntax to precisely define the information you want to extract from a Relatics workspace. This article describes the building blocks needed to build a script for providing interfaces.
Iterator
[Action]
{@Id}
{Name}
[.Action]
In the example above, [Action] is an iterator. By using an iterator in a script, Relatics is instructed to ‘iterate’ through all elements of the specified type element (e.g. Action). In other words, Relatics will go through every element in the type element Action. Between the iterator tags, Relatics is instructed to parse syntax for every iteration of the specified type (e.g. Action). In the example, this means that for every Action, the ID and Name are provided.
Notes:
- Only a single root iterator may be used in the script.
- An iterator can be recognized by brackets and the name of a type within the brackets. For example, [Action].
- An iterator is closed by brackets with a dot and the type element name. A notation variant is brackets with a dot. For example, [.].
- Sorting is not supported in a providing interface iterator.
- When the type element in the iterator is an external type element, the output is enriched with a system property {@externalId} that contains the unique identifier stored by the receiving interface.
Inserter
[Action]
{@Id}
{Name}
[.Action]
In the script examples given earlier, you may have noticed model references between curly braces (e.g. {Name}). These so-called inserters are used to define which Relatics properties will be included in the proving interface response.
Notes:
- What is between curly braces must equate to one value per iteration.
- A single iterator can have multiple inserters.
- Properties of the Attachment datatype cannot be published.
Next to properties, system attributes can be used for inserters. System attributes are not defined by a power user but, instead, are predefined by Relatics. Inserters with system attributes can be recognized by the @ symbol. Notice how, in the example given earlier, the inserter {@Id} was responsible for printing the IDs of the Iterator Action.
| System attribute | Description |
|---|---|
| {@Id} |
This system attribute prints the value in the corresponding element ID column (e.g. ACT-1).
|
| {@DisplayName} | This system attribute prints the value of the display name of an element part of a collection relation. |
| {@externalId} | This system attribute prints the unique identifier that this element is known by in the external application. |
Nesting
[Person]
{@Id}
{Name}
[is responsible for: Action]
{@Id}
{Name}
[.is responsible for: Action]
[.Person]
An iterator is an instruction for Relatics to reach specific type elements. It gives navigational instructions to the script, similar to how you click on an element Relatics table to navigate its relations and properties. It is possible to include the Actions by a responsible Person in the script output. We can achieve this by nesting our iterators like in the example above. With the iterator [Person], an iteration is started through all elements of the Person type element. Nested in is another iterator [is responsible for: Action], which for each person, iterates across all their actions. The Actions are included because of the {Name} inserter.
Notes:
- Within the inserter braces, multiple paths can be used, but they must lead to a single value per iteration.
- Contrary to report syntax, a nested path within a single inserter is not allowed to include type property values. However, type properties can be used in filters.
Hierarchy
| INCLUDEHIERARCHY()
|
INCLUDEHIERARCHY specifies that the entire hierarchy of objects, including their subobjects, is queried.
|
Archived elements
By default, iterators loop through all the elements of a type element. This is also true for type elements where archiving is configured. In case you only want to iterate through a specific archiving state, some extra syntax has to be added to the iterator:
| Archived state | Script |
|---|---|
| Live only |
|
| Archived only |
|