Create Contract

This guide shows how to convert a static legal contract into a dynamic one.
1 Define goals

The intent of this guide is not to create a real contract, but instead to show the steps required to do so. The end result is just a sample document.

2 Copy/import raw text into Tag

There are many free contract templates. This one is from docsketch. Most of the clauses have been deleted.

You can paste from clipboard, or use the Create report from *.docx document... menu item under the plus menu under the file tree.

As you decide which clauses to keep, make notes about what data fields you want, both for inserting values and driving conditional logic.

3 Create data setup file

In the Setup screen, create contract.rng and add fields identified in the previous step. Add Labels and select the appropriate Form control for each field.

4 Import data setup

Return to the Templates screen and use the Import data setup... menu item to open an import dialog.

5 Select file to import

Select the data setup file created earlier and click Open.

6 Confirm import

Click the Confirm button to add the file as a direct data setup import.

7 Insert effective date

Select the underline area representing effective date and open the value-of menu on the Logic toolbar. Use the Select dynamic value... menu item to open the expression dialog.

8 Go to Quick values panel

Click on the Quick values radio button and expand the Source data tree.

9 Insert effective date value

Expand the Effective date branch and select the desired date format. Click Insert when done.

10 Repeat for all fields

Repeat the prior step for all underline areas.

11 Make delivery clause conditional

Select the delivery clause in text and use the Select first when condition... menu item under the choose menu on the Logic toolbar. This will open the expression editor.

12 Create an expression

Select the Basic panel which builds one or more 3-part condition statements. Click on the left part and select Delivery location in the Source data menu.

13 Complete the expression

Finish this expression by selecting "does not equal" in the center part, and a Literal string value of '' in the right part. Click Insert when done.

14 Expand the decision tree

Expand the decision tree graph to view the logical flow of this clause. A choose/when instruction will insert the first when fragment that has an expression which returns true, or the otherwise fragment if there is one.

15 Review the when fragment

Nothing needs to be done here. This when fragment will be inserted if the deliveryLocation field has a non-empty value. Review that the wording is still what you want.

16 Add an otherwise fragment

Click on the otherwise branch in the decision tree and type some content.

17 Save changes, go to Forms

Click the save tool and go to the Forms screen to test the new dynamic contract. Note that an if instruction was also added to hide the late payment penalty clause if the late payment checkbox in the form is false.

18 Create a data file

Using the plus menu beneath the file tree, use the Add data file for / Report in this folder... menu item to open a dialog.

19 Select the report

Select the report created earlier and click OK.

20 Name the data file

Enter a file name using using the standard Windows or Mac file selection dialog.

21 Enter data

Go to the contract form tab, enter some test data and click the Save button.

22 Generate the contract

Click the magic wand tab to return to the generate page. Click on the big magic wand tool to generate a *.docx copy of the contract.

23 Open *.docx document

After generation, the new contract will open in your default word processor ready for final editing.

It is considered best practice to rename this file before editing manually, to avoid losing manual edits in the event of accidental re-generation.

24 All done

That's it for this guide. Try changing the deliveryLocation and latePaymentPenalty flag to see how the content changes. You can repeat these steps using other contract templates and/or other document types.

All files described in this guide can be downloaded from the "Legal contract (product)" sample in the Samples app.

Step-by-Step Guides | Return to top