HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

LENGTH Function

The LENGTH function returns the number of characters (including spaces and punctuation) in the text string you specify.

You can use this function when you want to know how long an answer is for a Text variable, and adapt the assembled document according to its length.

Function name

LENGTH

Usage model LENGTH ( t:TEXT )
Parameters This function requires you to replace only one parameter:

t: TEXT

The function returns the number of character in the text value.
Result A number value.

Example

Say you want a user to add a descriptive paragraph about the novel he or she has just reviewed. If the description is brief, you’d like to keep it in the same paragraph as the lead-in sentence. However, if the user has much to say about the novel, you would like to start a new paragraph.

To perform this action, your script would appear as follows:

«IF LENGTH( Plot Description ) <= 150»
The novel's plot description is as follows: «Plot Description»
«ELSE»
The novel's plot description is as follows:
«Plot Description»
«END IF»