Text/MC Computations: "" // Computation body here IF RESULT = "" // Fall-back value here END IF Number Computations: 0 // Computation body here IF RESULT = 0 // Fall-back value here END IF Date Computations: DATE OF( 1, 1, 1582 ) // Computation body here IF RESULT = DATE OF( 1, 1, 1582 ) // Fall-back value here END IF
When a computation returns ***Computation***, it means that there was an unanswered variable, usually in an IF ... END IF block. By way of explanation, when HotDocs tests IF Variable = Value, there will be one of three results: TRUE, FALSE, or NULL. A NULL value occurs where Variable is ***Unanswered***, meaning that the expression is neither true nor false. Because it is neither true nor false, HotDocs simply skips the whole structure down to the END IF.
The way to avoid a ***Computation*** result is to start the computation with a default value. The typical defaults are "" (an empty string) for text computations, 0 for number computations (or some arbitrary value that your computation could not produce, such as -7878), DATE OF( 1, 1, 1582 ) or 01 JAN 1582 for date computations, and either TRUE or FALSE for true/false computations, as appropriate. This assures that the computation will have some value. You can then provide a test at the end of the computation to see if the default value remains unchanged (meaning that the body of the computation failed to produce a different value - probably because of an error). If so, you can try to make up for the error with a fall-back test.
The following example illustrates this principle. The computation sets the value of the text variable Supervisor-t according to who the StaffMember-t is. If StaffMember-t is unanswered or is a name not contemplated in the computation, the fall-back will take effect. (Note that simply using an ELSE will not produce the same result, since the ELSE section will never be evaluated if StaffMember-t is unanswered).
// Default value: empty string
""
// Choose an appropriate supervisor
IF StaffMember-t = "Bill Clinton"
"Can't be supervised"
ELSE IF StaffMember-t = "Al Gore"
"Sally's Day Care"
ELSE IF StaffMember-t = "Jimmy Dean"
"FDA"
ELSE IF StaffMember-t = "Tammy Faye Baker"
"Mary Kay"
END IF
// Fall-back value
IF RESULT = ""
"Bill Gates"
END IF
Alternative:
""
SET Supervisor-t TO UNANSWERED
// Choose an appropriate supervisor
IF StaffMember-t = "Bill Clinton"
SET Supervisor-t TO "Can't be supervised"
ELSE IF StaffMember-t = "Al Gore"
SET Supervisor-t TO "Sally's Day Care"
ELSE IF StaffMember-t = "Jimmy Dean"
SET Supervisor-t TO "FDA"
ELSE IF StaffMember-t = "Tammy Faye Baker"
SET Supervisor-t TO "Mary Kay"
END IF
// Fall-back value
IF NOT ANSWERED( Supervisor-t )
SET Supervisor-t TO "Bill Gates"
END IF