The ERASE instruction is one of the handier instructions in HotDocs if you are populating data dynamically more than once, or are using ‘temporary dialogs’ during your interviews. Use of this instruction will completely erase the contents of a variable or dialog, but be warned: it will erase all iterations of that variable or dialog!
Let’s say we’re doing an Estate Planning matter – you have the client, their spouse, a list of children, trustees, executors and some random beneficiaries. There’s a lot of entities in there. If you’re working with a system by Basha Systems, there would likely be a central party list that functions as a contact database. If you’re not, you have several repeats containing contact information. Either way, the approach is the same. The example I will use is a generic letter. You want to program a generic free-style letter that can be sent to any entity on the matter. But because you quite often wish to send letters to the same party consecutively (a few days apart), you want the generic letter dialog to retain the information of who a letter was last sent to. Here’s how you do it.
Create your dialog as you ordinarily would – name, address, salutation etc – lets call our dialog Generic Letter DLG. I won’t get into the import mechanics – all we’re showing here is the ability to clear an entire dialog easily. On that dialog, we’ll create a button that points to the computation Generic Letter Clear CO. The script of that is:
ERASE Generic Letter DLG
That’s it. If the variables on the dialog are saved in the answer file, then the next time you hit that dialog, the details of your last generic letter appear. If the user wants to use those details – great! If they don’t, they simply click the button and everything on that dialog is erased and the user can pick a new entity to direct a letter to. Be warned that you don’t use this on repeating dialogs, as it will erase the entire dialog and all of its iterations/repetitions.