Export Templates Syntax
Using the Templates functionality you can export data from ClariNet LS into a template which can be styled using the Tag Explorer.
The main areas of the Tag Explorer are shown below. The left-hand side presents the data model in a logical tree structure that is available to use within Templates. At the top level, there are high level entities such as the Case, the Insureds and the Transactions on a Case. You can then drill down into lower level properties of each, such as the Insured's name, the Case Face amount, transaction bid information, and so on. If you select a Case (underneath the Scratch pad on the right hand side, which will start empty and show -- please select --), then the tree will show the values corresponding to that Case next to each Tag.
You can drag and drop Tags from the tree on the left into the central Scratch pad area, or single left click on them to get more information about them. Similarly for the functions on the right hand side, you can drag and drop these into the Scratch Pad, or single click to get an explanation in the central area of what the function does.

Tag Expressions
All tag expressions take the form << Case.Face Amount > >
, i.e. they are surrounded with double ankle brackets. Anything within such an enclosure ClariNet LS will attempt to interpret - anything else it will treat literally.
Fields
The simplest kind of expression refers to a field from the data model. This is a dot deliminated path to the location of the field within the model. For example, to access a top level field with the Case entity, we use << Case.Face Amount >>
. To access something another level down, such as Policy Number, we can do << Case.Policy.Policy Number >>
.
Functions
Functions can be stand-alone, or you can use them to act upon a field from the data model. For example, an example of a stand-alone function is << UtcNow() >>
, which simply outputs the current UTC date at the point the template is executed by ClariNet LS. A function that acts upon a data model field has the following syntax: << Primary Insured.Age() >>
. Here, we take the field Primary Insured, and we use the function Age() on that value. Functions can be chained together, and each successive function to the right will act on the output of the on preceeding it.
Please use the function quick reference on the right hand side of the Tag Explorer for information about what each Function does, by left clicking on the function name. Help information will then appear in the central area.
Variables
Variables are a means to provide custom data to a template from ClariNet LS, or help you track certain information within a template. Variables are prefixed with a dollar sign, and you can call them anything you like, though it must consist of alphanumeric characters. When executing over multiple Cases, those Cases will be provided to the template as a variable in the variable $Cases . You can define other custom variables to supply to the template from ClariNet LS from the Parameters sub-tab of the Export Template management section when editing a template.
Within a template, you can assign or change variable values with an assignment expression. This has the syntax $MyVariable = 4
. Where the left hand side of the expression is the variable you wish to assign, and the right hand side is the value you want to assign. The right hand side can be any valid expression. To retrieve the variable value, you just use the variable name on its own. For example, below we assign the variable "$DoubleCaseAmount
" to be the Case Face Amount multiplied by two. We then send that value to the output with the expression << $DoubleCaseAmount >>
below it.
<< $DoubleCaseAmount = Case.FaceAmount * 2 >> << $DoubleCaseAmount >>
Operators
The Tag framework provides some common operators that can be used for arithmetic, comparison or other operations. The available operators are shown below. Normal precedence rules apply for arithmetic operators; in expressions you can use parenthesis to change the order.
Operator | Description | Example | Example Output |
---|---|---|---|
* | Multiplication | << 4 * 4 >> | 16 |
/ | Division | << 8 / 4 >> | 2 |
+ | Addition | << 4 + 2 * 2 >> | 8 |
- | Subtraction | << 4 - 4 / 2 >> | 2 |
. | Accessor | << Case.FaceAmount >> | Face amount from Case |
== | Equality | << 1 == 2 >> | false |
!= | Unequal | << 1 != 2 >> | true |
= | Assignment | << $x = 2 >> | $x will be assigned value 2. The output will be nothing. |
> | Greater than | << 4 > 2 >> | true |
>= | Greater than or equal to | << 2 >= 2 >> | true |
< | Less than | << 4 < 2 >> | false |
<= | Less than or equal to | << 2 <= 2 >> | true |
&& | AND operator | << 1 == 1 && 2 == 3 >> | false |
|| | OR operator | << 1 == || 2 == 3>> | true |
Working with Collections
Accessing specific items
At some point you will encounter a tag field that is not a single date, text or number, but a collection of several of those values. In the Tag Explorer, such fields are indicated with the collection icon. Generally, you cannot output these directly to a template as this does not make sense. You need to use functions or iterate over the items in order to produce output for them.

In the example above, we are looking at the Underwriter Reports, which is accessed with the << Primary Insured.Underwriters Reports >>
tag.
In the Case we have selected in the Tag Explorer, it is telling us this is a collection containing 2 items. If we try a template that outputs that tag directly, in the output we will see the following error: #ClariNet: The expression ”<< Primary Insured.Underwriters Reports >>
” resulted in a value that cannot be output. That is because we need to be more specific about what we want from this collection. For example, let's say we want to output the Mean LE 50 of the first report in the collection. We would use the .First() function to do that: << Primary Insured.Underwriters Reports.First().Mean LE 50 >>
.
Similarly, you could use Last() to target the last, .Skip(1).First() to target the second item in the collection, and so on.
Sorting
Now we know how to target items in a collection, but often collections are not guaranteed to be in any particular order, or we do not know what the order is, so this is not very useful. Therefore, we need to define the order of the collections first. Let's take the underwriter report example, and order it first by the date of the report, and take the most recent. We can use the SortBy function to do that, for example:
<< Primary Insured.Underwriters Reports.SortBy(ReportDate, "DESC").First().Mean LE 50 >>
.
The key function here is SortBy , which takes two arguments - the first expression is that one to sort by. In this case, we are acting upon the Underwriter Report entity that has the field ReportDate within it. The default would be ascending order, which we do not want as we want to target the most recent date - so we use the argument "DESC" which indicates to sort in descending order. We then use the First() function to access the first item in our sorted collection, and output the Mean LE 50 field from it.
Filtering
We now know how to sort and access single items within a collection. But what if we wanted to consider only certain items within a collection? Let's say we were only interested in reports by the underwriter ITM 21st. We can filter collections to achieve that using the Where function. For example:
<< Primary Insured.Underwriters Reports.Where($c, $c.Underwriter.Short Name == "ITM 21st").First().Mean LE 50 >>
The above will output the Mean LE 50 of the first report by ITM 21st. The Where function accepts two arguments - the first is a variable, and the second is a predicate expression. What this means in practice is that ClariNet LS will loop through the collection one item at a time. Each item in turn will be assigned to the variable you provide as the first argument. Once that is done, it will evaluate the expression you provide in the second argument. Normally this expression will refer to the variable of the first argument, so you can make some comparison on it, and return a true or false to indicate whether it is a match for what you are looking for. So in the example $c contains an underwriter report, and within it we check the sub field Underwriter.Short Name and compare it to the literal value "ITM 21st". If it is a match, it will return true, and that item of the collection will be included. Otherwise, it will be skipped over. So for a collection containing two $c will be assigned twice, and the expression $c.Underwriter.Short Name == "ITM 21st" will be evaluated twice. You can chose anything you like for the variable name, but it should not conflict with any other variables you use within the expression.
Outputting
We already know how to access individual items from a collection, and output data from them. But what if we want to output more than one item from a collection? To do that, we need to iterate over them in the template. We can do that using the ForEach function.
<< ForEach($u, Primary Insured.Underwriters Reports.SortBy(Report Date, "DESC")) >>
The report date is << $u.Report Date >>. The report has a mean LE 50 of << $u.Mean LE 50 >>.
<< Next() >>
In the example above, we continue to work with our Underwriter Reports that we have ordered by most recent first. The ForEach function takes two arguments, the first is a variable that contains the current item from the collection specified in the second argument. This variable name can be anything you like, but should not conflict with others in the template. So for example, if you were already using $u for another purpose in the template, you would probably avoid using it. If there were two underwriter reports, $u would be assigned twice. The second argument is the collection to iterate over, which can be directly a field containing that collection, or one that we have manipulated using SortBy or other functions.
A ForEach function must be paired with a corresponding Next() function. The Next function indicates the end of the current iteration, and resets the template to the position of the ForEach to begin a new iteration on the next item. The space in the template taken by the ForEach and Next tags is consumed and do not form part of the output. In the scratch pad, we can see below for a spreadsheet this means our output would have two lines because there are two items in the collection.

The point of Export templates is to let you choose the formatting, so this will also be preserved. For example, if we had an Excel template like this:

The output on our Case with two underwriter reports looks like this:

Notice that the formula has been automatically adjusted to match the output of two rows, so instead of B2:B4 it is now referencing B2:B3. The formatting of the header and footer have been preserved, and the footer has been lifted up a row so it remains in the same relative position. As we are iterating an area that spans three columns, the Next() must be positioned in the bottom right cell of the area we want to iterate. The ForEach is always in the top left. Any cells vertically below the iteration area will remain in the same relative position, but anything to the right or left hand side, or above will not be moved.
Formatting Values
The values the Tags provide correspond to the raw values stored for the field. For example, dates include timestamps even if they are only used to represent date values and the time portion is not relevant. You may not want these in your output. When outputting to Excel, this generally is not a problem as you can use normal Excel formatting options to control the format of numeric and date values. However, if you're outputting to a text target, or you are combining several different fields together in the same cell, you may need to specify the format for a tag. In that instance, you can use the .Text() function to do that. The text function accepts a string as the only argument which specifies the format to convert the value to.
This can work on numbers or dates. There are lots of possibilities for what you can provide here, below lists some common possibilities.
Number Formatting

Date Formatting
