Adding conditions to text fragments
We highly recommend taking a look at getting started with conditions before reading this section.
You can add more complicated text fragments to your model by adding text fragments under a certain condition. To quickly illustrate this, go to node ‘finish’ in the graph ‘penalty’ in the accompanying model. Write something like this in Word:
Added fee per day of continued violation: €fee
and drag it to the text fragment editor in the Studio. Press
[F6] (see shortcuts) and select the appropriate variables for the penalty sum and the sum of money that one has to pay per day the violation is continued.
We only want the text to appear if the user actually choses to include a penalty clause. Therefore, we click the three-dotted button under conditions. Here, we make sure that the question asking for whether or not to include a penalty clause equals ‘yes’, and insert it as a condition.
[OK] and drag the text fragment into Word.
The beauty of adding text fragments in this way, is that you can add any style you like to your template document. To illustrate, we can put the top fragment in bold, and align the penalty clause in the center. One important thing to keep in mind when working with styles is that you should add stylistic changes after you have taken your text fragments from the document ‘Text fragment’ window. If you do this before, the styles will get lost.
To check if it worked, we will have to save the Word document. Two things are very important to the saving process. The first is the saving folder. Make sure that you save the document in the same folder as where you saved your decision tree model. If you don’t know where this folder is, just check the top of your running Studio. Secondly, make sure that you save the document under the name that you used in the decision tree model. So, in this case, use “testreport”.
For the final step, close the word window and enlarge the Studio again.
Make sure to fill in the names of the “buyer” and “vendor“, select to include a penalty clause and add the sums of money in the text boxes. Once you reach the document page, click the link and the document will appear. As you can see, the “buyer” and the “vendor” have been replaced by the names that you filled in, the penalty clause appears with the right numbers and the styles you added have remained intact! Go ahead and change your ‘yes’ to the penalty question to a ‘no’, and you will see that the end document will not contain a penalty clause.