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

VALUE Function

The VALUE function returns the default value you stipulate if the template user leaves the variable you specify unanswered.
You can specify a default value if the variable you provided has been unanswered, otherwise it will return a default based on the type of variable. If you do not specify a default type, it will return one of these:  

    "" for Text variables

    0 for Number variables

    1 JAN 1800 for Date variables

    FALSE for True/False variables



Function name VALUE
VALUE VALUE ( v:VAR, default: )   
Parameters This function requires you to replace two parameters:

v: VAR

The function returns the value the user gives to a variable and returns a default value if the user has not answered it.

default

The function returns the value the user gives to a variable and returns a default value if the user has not answered it.
Result A date, number, text, or true/false value.

Example

In the following example, suppose you need to calculate a total. However, one of the variables in the calculation, Sales Tax, may not be required. Since the variable may be left unanswered, you can use the VALUE function to assign a default value. 

Services Cost + Product Cost + VALUE( Sales Tax )

In the above script, the value returned for VALUE( Sales Tax) is zero if unanswered because there was no default specified and the default for a Number variable is zero. 

Services Cost + Product Cost + VALUE( Sales Tax, 10 ) 

In this script, the VALUE ( Sales Tax, 10) would return 10 if unanswered.

Download

After you download the example template, you can import the template to any workspace to see this example code in action.