Format Dollar Amounts
When working with dollar amounts, you can use various formats to merge the answers in your template. For example, if you use the $9,999.00 format, possible results are $1.99, $50.00, and $12,999.75. On the other hand, using the Nine Dollars and Twelve Cents format with the same numbers would produce One Dollar and Ninety-Nine Cents, Fifty Dollars and No Cents, and Twelve Thousand Nine Hundred Ninety-Nine Dollars and Seventy-Five Cents.
Most dollar amount formats can be applied by assigning default or field-specific formats to variables. The following list contains examples of formats you can use as is or modify to meet your needs:
Sometimes, there is no way to use a single number format to format a dollar amount exactly as you would like. For example, if you do not want to include and no cents for whole numbers, you must use the Nine Dollars format. However, if the user enters a number that includes cents, this format would truncate the cents. Instead, you can use a Computation variable to analyze a number and apply the correct format depending on how the user answers the question.
The first example script shows how to omit and no cents for whole dollar amounts and include the text for other amounts. Specifically, the computation compares the actual value of a Number variable against its truncated value. If the values are equal, HotDocs uses the Nine Dollars format. Otherwise, it uses the Nine Dollars and Twelve Cents format.
The second example shows how you can substitute the word No for a zero (0) if there are no cents, but otherwise use the numbers. For example, when writing a check, you may want the amount to appear as Five Dollars and No/100 or Five Dollars and 75/100, but not Five Dollars and 0/100.