The DECREMENT and INCREMENT instructions are relatively new to HotDocs and they serve identical, but reversed purposes. DECREMENT will reduce a given number variable by one, whereas INCREMENT will increase by one.
These two instructions are most useful in conjunction with WHILE and REPEAT instructions. Lets say we are doing some real estate templates and one of the templates is ONLY required where there are one or more corporate borrowers. To do this, we could just use a TF variable that is set to TRUE if there is at least one corporate borrower, but that isn’t as useful as knowing exactly how many corporate borrowers we have. Making MORE specific information available to your system is nearly always better than “the shortest approach”.
SET BORR Corporate CNT TO 0 //our var to store how many corporate borrowers
REPEAT BORROWERS RPT
IF BORRS Corporate TF = TRUE //a checkbox on the dialog if the borrower is a company
INCREMENT BORR Corporate CNT
END IF
END REPEAT
And that’s it. At the end of this, BORR Corporate CNT will contain the number of corporate borrowers we have. The same usage would apply in a WHILE statement, except that in a WHILE loop, it is nearly always imperative that you have an INCREMENT (or DECREMENT) statement. The reason for this is that REPEAT will auto terminate when you have finished the repeated answers whereas WHILE does not – YOU must manually code that ‘cut out’. And that’s where INCREMENT comes in.
At the end of the day, INCREMENT and DECREMENT could already be achieved in HotDocs scripting as follows:
INCREMENT: SET Variable NU TO Variable NU + 1
DECREMENT: SET Variable NU TO Variable NU - 1
Both of these would work. But these two new instructions are cleaner and easier to type. And lets face it – convenience and clean code are pretty cool things to have.