Convergence Template Markup Notation


Convergence templates use a special text notation to indicate where in the template data should be put. Template markup tags also exist for conditionals, table repeats, and some formatting. Template markup can be used in an HTML or any text based document, or might be stored in the Convergence database as it is for PDF templates and for color code scripts.

Most common template markup tags can be automatically entered using the Data Tag Palette in the template editor. It is poossible to create and edit document templates without knowing the template markup format at all. However, there are yet more features to template tags to be found by reading this section and typing some template tags in by hand. Understanding the tag notation will make reading and editing your templates go more smoothly. If you have no privilege to edit templates, you will never see these template markup tags, and need not worry about them.

Tag Notation

Template markup tags always begin with {$ and end with $}. There may be no other $, {, or } anywhere inside the tags, except if another valid tag is included inside the tag. Tags are not case sensitive, so {$client.name$}, {$Client.Name$}, and {$CLIENT.NAME$} are all equivalent tags.

Data Tags

Data tags are markup strings that are substituted with data when a document is generated. A tag like {$case.status$} is put where the case status goes when a new document is generated from the template. Inside a data tag, there is a table name, a dot, and the data field name. A data tag can leave out the table name, like {$wcabno$}, but that is only reliable if the field name is unique to that table. If you include a tag like {$address$}, you may not be sure whose address will be there, since a data field 'Address' exists in a few places in Convergence.

The table name designates whether the data field is from the case record, the client, an organization, a contact, a case note, an invoice, or an event type. The tag {$invoices.amount$} will fill in with the amount from an invoice. The tag {$notes.amount$} will fill in the billable amount from a case note.

The table names cases, clients, organizations, contacts, invoices, invoiceitems, schedule, user, and template are always supported by the template reader. In addition, table names can be whatever the admin user has named your cases, clients, and contact types. For example, if your database calls clients patients, both {$clients.email$} and {$patient.email$} will fill in with the email of the patient. If you have a contact type 'Applicant Attorney' the tag {$ApplicantAttorney.fax$} will fill with the fax number of the applicant attorney. There is a special table name for invoice templates, billto. This will fetch information about the billable party for the invoice, whether it's the client, or any one of the contacts for the case. The tag {$billto.address$} will fill in with the address of the billable party.

The contents of the Appointment Type field for events can also be used as a source of table names, so that dates from different kinds of events can be put in a template. For example, {$InitalAppointment.date$} will fill in with the date from an event of type 'Initial Appointment', provided there are no other tables named 'Inital Appointment'.

The data tag interpreter tries hard to make sense of your input. It accepts table names both singular or plural, will use a substring test if no exact match is found, and will use acronyms if they don't conflict with other table names. For example the tag {$IE.date$} will fill in the date of an event of type 'Initial Evaluation'.

The data field name can be a comma separated list of multiple fields. The data from the fields will appear in the document separated by spaces. The tag {$physician.fname,lname$} will fill the the current case's physician's full name.

Conditionals

Sometimes, a template needs to do one thing or another depending on what the data is for your case. For example, you may wish to include space for a contact address only if that address exists, or an invoice may wish to distinguish between whether an invoice item is a charge or a credit. Conditional markers let a template decide what to do when the document is being generated, depending on what your data is at the time.

The basic format of a conditional markup is like this:
{$IF:some condition$}write this to the document{$END:IF$}

So for example to only write a name if it exists looks like:
{$IF:{$contact.name$}$}NAME: {$contact.name$}{$END:IF$}

If the contact name is empty, zero, or contains only whitespace, the if does not write the part up to the next {$END:IF$}.

The condition that the IF: is testing can be a comparison between things, such as:
{$IF:order.amount>=100.00$}FREE SHIPPING!{$END:IF$}

which prints 'FREE SHIPPING!' if the amount of an order record is $100 or more. The operators == for equals, != for not equal, >, <, >=, and <= are all supported by the template generator. In addition, the =~ regular expression operator is partially supported.

If conditions can contain arithmentic operators +, -, *, /, ^, and %. For example {$IF:{$PAGE:NUMBER$}>{$VALUE:itemCount$}+3$} will test if the current page number is greater than value of variable itemCount plus 3. Arithmentic operators are not used if the test comparison is a =~ regular expression test.

Sometimes a template needs to do one thing if the data test passes, and another if it doesn't. There is a tag {$ELSE:$} that separates what to do in one case and what to do in the other. For example:
{$IF:invoiceitem.amount<0$}Credit:{$ELSE:$}Charge:{$END:IF$}

will print 'Credit:' if a billable item has an amount of less then zero, and 'Charge:' if is not less than zero.

The =~ regular expression operator allows you to test substrings and other conditions on your data. For example {$IF:{$client.lname$}=~/smith/i$} will test whether the client's last name contains 'smith'. the i at the end of the regular expression indicates the comparison is case insensitive, so 'Smith', 'Sixsmith', and 'Wintersmith' all match the test. Regular expressions start with a '/' and end with another '/'. Those of you familiar with regular expression know they can do much more kinds of pattern matching. Most regex options are supported, with the exceptions that the case insensitive 'i' and single line 's' are the only modifiers supported, and that {, }, and $ are not allowed inside a template tag, including in a regular expression inside a tag.

A template condition can be made its opposite with a ! in front of the condition. For example:
{$IF:!{$client.fname,lname$}$} No <$client> name filled in. {$END:IF$}

means that if neither the client's first or last names are filled in, indicate this with a message.

Conditions may include and/or of multiple conditions. The symbol && is the AND operator. Where it is used, both conditions have to test true for a chunk of template to be used. For example this code will put out a warning message if there is no attorney and no law firm associated with the current case:
{$IF:!{$DefenseAttorney.fname,lname$} && !DefenseAttorney.organization$}$}
     <DIV CLASS="warning">No defense attorney or legal office for this case.</DIV>
{$END:IF$}

The symbol || is the OR operator, and either of two conditions may be true to use a piece of the template. For example this code will display a WCAB number if the case type is either WC or OWCP or DFEC:
{$IF:{$case.type$}==WC || {$case.type$}==OWCP || {$case.type$}==DFEC$}
     <P CLASS="msoNormal">WCAB#: {$case.wcabnumber$}</P>
{$END:IF$}

If && and || are both used in an IF: condition, the && tests are done first, then the || tests.

There are special conditions hidecasedata and showcasedata that depend on whether the current user has the 'Hide Case Info' box checked on their user page. These are primarily used to modify interface templates if case data needs to be hidden from some low level users. For example {$IF:showcasedata$} {$case.claimno$} {$END:IF$} only prints the case claim number if the current user has the privilege to view case data.

Table and Repeat Segments

Sometimes a table name is being used over and over for part of a template, like {$case.city$}, {$case.state$} {$case.zip$}. There is a way to set the default table for a block of template with TABLE directive:
{$TABLE:cases$}{$city$}, {$state$} {$zip$}{$/TABLE:cases$}

will do the same thing as the earlier chunk. The TABLE directive refers to a table name, and applies until a /TABLE directive or the end of the template. This is similar to how many HTML tags work.

If you need to refer to a table in a template chunk that repeats with every item found in the table for the current case, the REPEAT directive can be used in place of a TABLE directive. For example:
{$REPEAT:invoiceitems$}
     <div style="float:left;clear:left;">{$itemdate$} {$invoiceitems.itemname$}:{$invoiceitems.amount$}</div>
{/REPEAT:invoiceitems$}

will list out the billable items in an invoice.

The table name of a repeat can be 'cases', 'casenotes', 'invoices', 'invoiceitems', whatever names were assigned to cases or case notes in Admin Preferences, or the name of a contact or organization type set in Contact Type Admin. For example if you have a contact type 'LCSW' in your settings, {$REPEAT:LCSW$}LCSW Name:{$LCSW.FNAME,LNAME$}<BR/>{$/REPEAT:LCSW$} will list the names of all LCSW's assigned to the current case. There is also a special repeat table name 'outstanding' that repeats though outstanding invoices so that itemized outstanding balances can be created in invoice templates.

Square brackets after the repeat table name can be used to specify a range of results. For example:
{$REPEAT:invoiceitems[26-50]$}
     <div style="float:left;clear:left;">{$itemdate$} {$invoiceitems.itemname$}:{$invoiceitems.amount$}</div>
{/REPEAT:invoiceitems[26-50]$}

will list out items 25 to 50 of the current invoice. If there are fewer than 26 items, nothing will appear when the template fills in.

Sometimes it is useful to know how many times a repeat is filling in, or which item is currently repeating. There are directives to indicate current row, current index, total rows, and total rows for this repeat. {$ROW:NUMBER$} fills in with the row number of the repeat, 1 for the first row, 2 for he second and so on. {$ROW:TOTAL$} will fill in with the total number of rows in a repeat set. For example, {$REPEAT:casenotes$}Total Case Notes:{$ROW:TOTAL$}{$/REPEAT:casenotes$} will report the number of case notes for the current case. If a range of results is used, {$ROW:INDEX$} will fill in with the row number, so that {$REPEAT:casenotes[10-19]$}{$ROW:INDEX$}<BR/>{$/REPEAT:casenotes[10-19]$} will show 10, then 11, and so on until 19. The row numbers will still start at 1. {$ROW:COUNT$} will give you the number of rows in the current repeat, so a repeat [10-19] on a case with just 15 entries would show a row total of 15, and a row count of 6, the number of rows in the range of the repeat.

Macros

Macros are templates that can be placed inside other templates to allow the same template text to be used again and again. Once a template of type 'Macro' has been created, it can be referred to by its name in another template. Macros are useful for setting up chunks of template that will be useful in different templates, such as letterhead, billable party address, content that varies by case type, and any other template chunk that will be used in multiple places.

Macro tags are {$$ followed by the macro name, and ending with $$}, like other tags, but with double dollar signs. The tag {$$Return Address$$} will fill in the space with whatever's in the macro template named 'Return Address' before any other data is substituted.

Convergence comes with a few built in macros, such as 'MrMs' which eases setting up greetings for letters. The macro looks like:
{$IF:{$CLIENT.GENDER$}==F$}Ms.{$ELSE:$}Mr.{$END:IF$}

A letter greeting like Dear {$$MrMs$$} {$client.lname$}, will fill in the appropriate surname depending on what is entered for gender of client in the database.

Inline Macros

Macros, in addition to being defined as separate little templates, can also be defined inside a template, for use only in that template. This is useful when the same chunk of text is used over and over again in a template. An inline macro is defined between tags {$MACRO:macroname$} and {$/MACRO:macroname$}. If a macro page_width is defined as:
{$MACRO:page_width$}7.5in{$/MACRO:page_width$}

then the tag {$$page_width$$} will be filled in with '7.5in' wherever it occurs in the template. Other templates will not be affected by this. If an inline macro has the same name as a macro defined in a separate template, the inline macro will be used instead, overriding the template macro.

Macro Example: Variable Tax ID Numbers

For this example, let's suppose a business uses multiple tax ID numbers depending on what sort of case is being billed for on an invoice. The tag {$COMPANY.TAXID$} will substitute the tax ID entered by the admin user in the Preferences page, but that won't work if multiple tax ID's are in effect. The solution is to create a macro template 'Tax ID' and fill it with something like this:
{$IF:{$CASES.CASETYPE$}==SSI$}
     99-0123456
{$ELSE:$}
     {$IF:{$CASES.CASETYPE$}=~/Injury/i$}
          00-9999999
     {$ELSE:$}
          {$COMPANY.TAXID$}
     {$END:IF$}
{$END:IF$}

Using {$$Tax ID$$} in a template would then fill with 99-0123456 if the case type is 'SSI', and will fill with 00-9999999 if the case type contains the word 'Injury' (case insensitive). If neither of these conditions are met, the tax ID will be the one filled in on the admin Preferences page under company info.

Directives

There are a few handy directives to assist in formatting text. These use a tag and a / tag to mark an area, similar to HTML start and end tags. Directive tags and conditional (if) tags always include a ':' to distinguish them from data substitution tags.

The directive UC sets text uppercase. For example {$UC:$}{$client.fname,lname$}{$/UC:$} will print the client name in all caps. Similarly, the LC directive can set text to lowercase where needed.

The directive DOLLARS sets numbers to dollar figures, making sure there are two decimal places, and appending the dollar sign. {$DOLLARS:$}{$invoice.amount$}{$/DOLLARS:$} will print an invoice amount in a regularized dollar format.

The directive TENTHS sets a number to the nearest tenth, always having one decimal place. {$TENTHS:$}{$casenotes.hours$}{$/TENTHS:$} will set reported hours for a case note to the nearest tenth, with one decimal place always showing.

The directive INIT creates an acronym, the initials of the text between INIT and /INIT directives. For example {$INIT:$}{$user.fname,lname$}{$/INIT:$} will print the initials of the user assigned to the current case.

The directives RTOTAL and RCOUNT allow reporting of totals and numbers of items in the database. For example {$RTOTAL:invoiceitems.itemtime$} will show a total of hours billed for an invoice. The part after the ':' is a table name dot field name as in data tags to specify what data field to total or count. The tag {$RCOUNT:invoiceitems.amount$} will show how many items there are in an invoice.

Year,Month, and Day

Some forms require year, month, and day in separate blanks. There are tag modifiers to extract those from dates in Convergence. Tag modifiers added with a double underscore at the end of a data tag. Adding '__mm' at the end of a date will show the month number, and likewise '__yy', '__yyyy' and '__dd' will get the year and day of month. So {$case.referdate__yy$} will print the two digit year of the case referral date.

Checkbox Fields

When a checkbox field is used in a template tag, there are tag modifers to display that checkbox as an 'X' for checked, or Y/N for checked/not checked. Note that the tag modifiers start with a double underscore. The modifier '__x returns 'X' for checked, and nothing if not checked. The modifier '__yn will print 'Y' or 'N' on the template. The following code will place an 'X' in a box if a checkbox 'Service Agreement' is checked:
<DIV STYLE="width:16px;height:16px;border:1px solid black;"> {$case.ServiceAgreement__x$}</DIV>

This code will print a 'Y' or 'N' depending on whether checkbox 'Applicant Referral' was checked:
Applicant Referral: {$case.ApplicantReferral__yn$}

By default checkboxes show 1 for checked and 0 for not checked.

Page Breaks and Page Numbers

A set of special directives is used to control where page breaks occur, and count pages in a document. The tag {$PAGE:BREAK$} will place a page break in the document. The tag {$PAGE:NUMBER$} will fill with the current page number, and the tag {$PAGE:TOTAL$} is the total number of pages.

Variables for Tracking and Counting

The Convergence Template Markup notation has some provisions for creating and changing named variables. These are useful for counting repeats, or storing totals from a repeat segment. The directive {$AddToVar:VariableName:Amount$} will add amount Amount to the named variable. Variable start at zero if not set otherwise. For example {$AddToVar:InvoiceCharges:{$INVOICEITEMS.AMOUNT$}$} will add the amount of the current invoice item to a variable called InvoiceCharges. The directive {$SetVar:variableName:Amount$} will set the named variable to the value Amount, overriding any old values. For example {$SetVar:totalitems:{$ROW:TOTAL$}$} will place the total number of rows in the current repeat segment into variable totalItems. To get the value of a variable, use the directive {$VALUE:VariableName$}. For example Total Items:{$VALUE:totalItems$} will report the amount stored in variable totalItems.

Template Markup Examples

Include an organization name line in an address only if there is one:
{$IF:{$LAWFIRM.NAME$}$}{$LAWFIRM.NAME$}<BR />{$END:IF$}

Change what appears in a letter depending on whether a case activity/event has been entered yet:
{$IF:{$MedicalsReceived.date$}$}
     <DIV CLASS="style1">We received your medical records on {$MedicalsReceived.date$}.</DIV>
{$ELSE:$}
     <DIV CLASS="style2">We are still awaiting the receipt of medical records.</DIV>
{$END:IF$}

Test if a checkbox is checked. A checked box reports a value of 1. Here, a contact of type 'Mediator' is checked for certification by the fictitious ZNMRC:
{$IF:{$mediator.ZNMRCcertified$}==1$} ZNMRC certified {$END:IF$}

List any invoice items that are credits:
{$REPEAT:INVOICEITEMS$}
     {$IF:{$INVOICEITEMS.AMOUNT$}<0$}
     <DIV CLASS="tr">
          <DIV CLASS="lbl tdb" STYLE="width:100px;border-width:0px 0px 0px 1px;"> </DIV>
          <DIV CLASS="lbl tdb" STYLE="width:406px;font-weight:bold;border-width:0px;">
               {$INVOICEITEMS.ITEMNAME$} Paid on {$INVOICEITEMS.ITEMDATE$}
          </DIV>
          <DIV CLASS="lbl tdb" STYLE="width:72px;text-align:center;border-width:0px;"> </DIV>
          <DIV CLASS="lbl tdb" STYLE="width:80px;border-width:0px 1px 0px 0px;">
               {$DOLLARS:$}{$INVOICEITEMS.AMOUNT$}{$/DOLLARS:$}
          </DIV>
     </DIV>
     {$END:IF$}
{$/REPEAT:INVOICEITEMS$}

Macro to display initials after a case letter. The letter is for the user assigned to the case, and typed by the current user:
{$UC:$}{$INIT:$}{$CASEWORKER.FNAME,LNAME$}{$/INIT:$}{$/UC:$}:{$LC:$}{$INIT:$}<$USERNAME>{$/INIT:$}{$/LC:$}

Add an extra page and a page header if the variable TotalItems is greater than 25:
{$IF:{$VALUE:TotalItems$}>25$}
     {$PAGE:BREAK$}

     Page {$PAGE:NUMBER$} of {$PAGE:TOTAL$}<BR/>
{$END:IF$}



This manual is published by Convergence Case Management Data Retrieval Software, LLC, whose software products are provided for use by parties who have paid for and have a current license to operate the software described herein.

Information in this manual is subject to change without notice, and does not represent any commitment on the part of Convergence Case Management Data Retrieval Software, LLC. The software described in this manual is furnished under a license agreement and may be used only in accordance with its terms and conditions.

 © Copyright 2025 Convergence Case Management Data Retrieval Software, LLC

This manual contains propietary information which is protected by Copyright. No part of this document may be reproduced, translated into any language or computer language, or transmitted in any form whatsoever without the prior written consent of Convergence Case Management Data Retrieval Software, LLC.