Conditional text fragments
This section builds on the model and document of Introduction to Document assembly and further. We highly recommend reading those articles first. Furthermore, a basic understanding of conditions is advised.
In our Word template there was an optional agreement between the buyer and the seller. We would like this statement to appear if the user wants to, including the number of years. Below you can see the questions that determine this statement.
Just like with formulas and connections, you can add conditions to text fragments. The Berkeley Studio will then only create the text fragment if the condition is satisfied. If the condition is not true, the text fragment will not be made and the paragraph in the Word template will be deleted. You can also manually delete paragrahps.
To add a condition to a text fragment, first create a text fragment.
For our example, we will create a text fragment called
guarantee in the node
In it, we will place the text from the template and paste the
duration variable from the node
Next, we will add the condition.
To do so, either directly enter the condition in the condition field or do it through the condition screen (by click the
The second method is shown below in the image.
If you don’t know how to do this, please see conditions.
Now that we’ve added the condition to this text fragment, we’re almost done. We only need to put the text fragment in the template After that’s done, we’re ready! If the user choose a guarantee, it will be added. If not, the sentence “3. Buyer gets a guarantee of [number of years] years.” will simply be removed!