Adding text fragments

The template document you have just added to your decision tree model is where you will be adding text fragments to. The easiest way to create text fragments is to first fill your document with the desired texts. In these texts you can mark where certain variables from your decision tree model have to be entered.

A simple example illustrates this. We create a decision tree model that asks for the user’s name and birthday. The decision tree model has three nodes: start, information, and document:

Three nodes: start, information and document
Three nodes: start, information and document

The nodes will have the following tasks:

  • start introduces the decision tree model.
  • information has two questions asking the name and date of birth of the user. It also contains the formula age(). This calculates the age of the user based on the birthday input.
  • document will create and show the document

Let’s say we have a document that contains the following paragraph:

The Word document
The Word document

To add a text fragment, click on the node document and select Actions > Text fragment. Now you can add text and give the text fragment a name (in this example ‘welcome_greet’). Next, cut the text from your Word file to the text block field. It is important that you remove it from the Word file, otherwise it will end up being shown twice.

The Word text in the text fragment
The Word text in the text fragment

Now, we will add the variable that represents the name of the user. Select ‘[name]’ in the text fragment window and click on the finder or press [F6]. More information on the finder can be found here.

Navigating through variables
Navigating through variables

Select the question which asks for the name of the user (information.name). Double-click it and it will be added to your text fragment. If everything is done correctly, the text ‘name’ will be replaced by something like:

^{main.information.name}

Repeat the same process for the age. Your text fragment should look like this:

The text fragment after adding the variables
The text fragment after adding the variables

It is possible to use a variable as an identifier. That way you can dynamically create a description for text fragments. If the Editor thinks you mean a variable, it will tell you by warning you in de text ‘Identifier’ above the input-field. Only a fully qualified name (graph.node.data) will be seen as variable. If you do not want this, you can just add quotes, in this example, 'main.start.question3' in stead of main.start.question3.

Using variables as Identifier
Using variables as Identifier

These were the basics for adding text fragments. In the next section, we discuss how to make sure your text fragments end up in your Word document.