Remove Leading Space in Time Answers

From HotDocs Wiki

Jump to: navigation, search

In HotDocs, time values are usually represented with Text variables that use the 99:99 A.M. pattern. Unfortunately, when the answer for a time variable includes a single digit hour, HotDocs includes an extra space before the time when it is merged into a document.


You can use the following computation to format the time without the leading space. This computation looks at the first character in the answer. If it is a space, the computation returns all of the characters in the answer except for the first character. Otherwise, if the first character is not a space, the entire answer is returned.

In your template, instead of using the name of the time variable, you would use the name of the computation, as follows:

The meeting will begin at Ā«Meeting Time CompĀ» and will last approximately one hour.

In the following computation: Time Var is any text variable that uses the 99:99 A.M. time format:

IF FIRST( Time Var, 1 ) = " " 
  LAST( Time Var, LENGTH( Time Var ) - 1 ) 
  Time Var