Expertsystemen

 

Adding text fragments

This section builds on the model and document shown in the Introduction to Document assembly and Adding a document to your model. In those two articles, we showed how you can add a document to your model and present it to your user. In the coming sections on text fragments, we will explain how you can put content in your document.

The basics

A text fragment is an action in xxllnc Expertsystemen that creates a piece of text. Asides from the text, it also has a name and you can give it a condition. A text fragment can be created from almost anything, including plain text, questions and formulas. After a text fragment is created, you can put it in your template. Whenever a user runs through your model, the text will be put in the template and will be appear in the document.

The goal of a text fragment
The goal of a text fragment

A text fragment out of a question

In our example model (found at Introduction to Document assembly) we have a node called buyer. This node contains several questions about the buyer, such as his name and date of birth. We can create a text fragment out of this question in two ways. The easiest way is to right-click the question and select Copy this into text fragment. This will show a window where you can enter the name for the text fragment, after which the fragment is added.

Copying a question into a text fragment
Copying a question into a text fragment

The other way is to manually add the question to a text fragment. To do so, first add a new text fragment via [Actions > Text fragment]. Make sure you add this fragment after the question you want to put into it. This ensures the question is answered first, otherwise it would be empty. Give the text fragment a name, and place select the Text block field. Then, select the finder Finder or press [F6]. Navigate to the question and double-click it to add it.

Manually adding a question into a text fragment
Manually adding a question into a text fragment

After you’ve done this, name will appear in red in the text block. This is short for the full name of the questions (main.buyer.name).

We’ve now added our first text fragment. Adding more text fragments can be done in exactly the same way. As mentioned before, you can also create them from formulas or the results of functions.