HotDocs Instruction – LANGUAGE

The Language instruction allows you to design, code and assemble templates in HotDocs in a language other than English.  To be able to use this feature, you must first contact a Lexis Nexis sales representative to obtain a DLL for the language you wish to program with.  HotDocs has DLLs for the following languages:

ENG (English), DEU (German), DES (Swiss German), DEA (Austrian German), FRA (French), NLD (Dutch), ESN (Spanish), ITA (Italian)

Using any of the codes above, the instruction you place in your template is as simple as:

LANGUAGE FRA

Also with the Language instruction, it is possible to format the thousands and decimal separators.  The following instruction would use the Italian language, set the thousands separator to a period “.” and the decimal separator to a comma “,”.

LANGUAGE ., ITA

INSERT template

Not to be confused with the ASSEMBLE command (which queues a template for assembly after your current template has finished), the INSERT command does exactly that – inserts the content of one template into a different template (known as the “parent” template).

This instruction is extremely handy and very under utilised as it is useful for a wide variety of things, not just inserting letterhead!

The INSERT command should largely be used in templates.  There are ways to use the INSERT command inside a computation, but there are limitations and rules that apply.  Allegedly, an INSERT command cannot be placed inside headers or footers in your template however, we have found that it works just fine with footers, which can save some time in some situations.  At any rate, here’s how it works in several different ways –

Template in same location as the template you are inserting into (known as the “parent” template)
«INSERT “Template.rtf”»

Subfolder of location of parent template
«INSERT “SomeSubfolderTemplate01.rtf”»

Full file path for anywhere on your system
«INSERT “T:HDTemplatesLitigationTemplate01.rtf”»

Using a Reference path
«INSERT “^HotDocsLitigationTemplate01.rtf”»

Default Templates folder
«INSERT “Template01.rtf”»

The INSERT statement is quite often used inside IF statements to conditionally insert oeprative parts of documents.  Interstate notices, optional schedules, attached forms etc are all usually INSERTed inside IF statements.

Common Uses for INSERTed Templates

  • All stationery, such as letterheads, faxes and memos, with accompanying headers, footers and page numbering
  • Signing / execution clauses (say, a single “corporate execution” block and a single “power of attorney execution” block)
  • Court headers and footers
  • Boilerplate text such as acceptance clauses, court seals, hearing dates, witness blocks and the like
  • RE lines on letters
  • Schedules

Additionally, INSERTed templates are quite often used simply to segregate content in long templates, so that each template can be tested by itself in isolation to the rest of the template.

Some Off Label Uses

With a bit of effort, it is possible to set up INSERT templates to take parameters.  All you have to do is write your INSERT template with a temporary variable that you SET before you insert.  Here’s a quick example:

INSERT Template Code:

Some random text up here that is boiler plate and always appears regardless of how the INSERT template is used.

«IF OPT UseNotice TF = TRUE»
This notice must be complied with within 14 days unless otherwise specified.

«END IF»
More random text here about something or nothing at all really.

«IF tmpTE = "Borrower"»
This notice is directed to the Borrower's solicitors and must be complied with within 7 days of the date hereof.
«ELSE IF tmpTE = "Lender"»
This notice is directed to the Lender's solicitors and must be complied with whenever convenient to the Lender.
«END IF»

«IF OPT UseFooter TF = TRUE»
This footer is absolutely pointless except insofar as it demonstrates the concepts of parameters in INSERT templates as applied by the HotDocs document assembly engine.
«END IF»

So all we have really done here is code the INSERT template with some preset variables to hold preset values.  Then, when its time to insert the template, we set the parameter variables prior to inserting the template.

PARENT Template Code:

«SET tmpTE TO "Borrower"»«SET OPT UseNotice TF TO FALSE»«SET OPT UseFooter TF TO TRUE»
«INSERT "OurInsertedTemplate.rtf"»

IF, ELSE IF and ELSE

The humble IF statement is the core of all logic in any programming language, HotDocs included.  IF statements don’t actually do anything but rather, they provide a structure within which other commands are executed.  To bring any intelligence to your document-producing systems, you must understand the IF, ELSE IF and ELSE statements, as they are used everywhere.

I’ll work with a computation for these examples, as it is simpler than the template version, as no chevrons are required.  Lets get some examples happening.  Lets say we have a variable named “Var TE” and Var TE has a value of “Bob”.

Example #1a – the basic IF statement

IF Var TE"Bob"
"His name is Bob"
END IF
//this would produce "His name is Bob".

Example #1b – the basic IF statement

IF Var TE"Joe"
"His name is Joe"
END IF
//this would produce an error

The above code produces an error because Var TE does not equal Joe (it’s still Bob) and there is no script in place to handle what happens if the variable isn’t equal to “Bob”.

So lets look at how to handle that with an ELSE statement.

Example #2 - IF and ELSE
IF Var TE"Dave"
"His name is Dave"
ELSE
"His name is not Dave"
END IF
//this would produce "His name is not Dave".  In this example - we have some code to run if his name is "Dave", ELSE (readable as "if its anything else in the world..."), produce "His name is not Dave".

This still isn’t ideal.  What if we want to do something specific for Bob OR Dave, but something entirely different if it isn’t either of them?  Lets look at the ELSE IF statement.

Example #3 – IF, ELSE IF and ELSE

IF Var TE"Dave"
"His name is Dave"
ELSE IF Var TE"Bob"
"His name is Bob"
ELSE
"His name is not Bob, nor is it Dave"
END IF
//This would produce "His name is Bob". If we set Var TE to the value of "Mark", the result would have been "His name is not Bob, nor is it Dave"

The easiest way to read this stuff when you’re learning is as follows:

IF (Some specific condition is true)
//do something here, for this condition only
ELSE IF (Some other specific condition is true)
//do something different, for this condition only
ELSE (if its anything else in the whole wide world)
//do something different here if nothing previously is true
END IF (close the statement)

In english, it would read exactly as it is typed above – IF something is true, do something, else if something different is true, do something different for this condition only, else if its anything else in the whole wide world, do something here.  It gets tricky, but it is really just a series of “what if this is true” questions and results.

Some things to remember….

1) Every IF statement must have a matching END IF – they are a fixed pair with no exceptions!
2) ELSE and ELSE IF statements can only occur inside an IF/END IF pair.  They do not have matching END IFs themselves
3) Nested IF and END IF pairs must nest “inside” each other.  I’ll use bracketed numbers in place of conditions to demonstrate:

IF (1)
//do something

IF (2)
//do something here
ELSE
//do something different
END IF(2)

IF (3)
//do something different again
ELSE IF (3)
//do something weird
ELSE (3)
//do something really weird
END IF (3)

END IF(1)

As you can see, IF statements work from the inside out.  It is nearly always best practice to write your IF and END IF at the same time, then move your cursor back and complete the rest of the commands between the IF/END IF pair.  If you open an IF statement and immediately close it, you will not lose where you are up to with code and save yourself substantial time debugging problematic HotDocs code.

Please note: HotDocs will evaluate your IF statements from top to bottom.  In the above example, if IF statement #2 was true AND IF statement #3 was true, HotDocs would only produce #2 – because it will find a true If statement, produce the result and then jump straight to the END IF.  Bear this in mind when designing your code.