How to Create Conditional Text

Top Previous Topic Next Topic  Print this topic

To insert Conditional Text, follow the instructions provided below.

 

1. In the Insert Tab in the Ribbon, select the Dynamic Element button. You will be presented with the Insert Dynamic Element Dialog.

 

2. Next, you will be presented with the Insert Conditional Paragraph Dialog where you will need to set your initial condition. The steps below will walk you though creating the first condition.

 

a. Select in the Data Tree the data value to base your condition on. In this example, the "gender" attribute will be used. Your selection in the Data Tree will be highlighted for visual reference.

 

b. Then, choose your type of condition based on available options for based on occurrence, numerical value, or text value. In this example, we want to show text based on the value of the gender field, so we will select Based on text value.

 

c. Then specify the details of your condition for contains or starts with using the drop down menu available and then add the value to test for. Here we have added "female" by typing in the value field. You can create more complex conditions manually by selecting the Create Expression button. When you are finished configuring your condition, select Insert.

 

condtext_new2

Figure 1: All the configurations have been set for our first condition.

 

3. You will notice in the Design Surface that your first condition and the fallback section will be added as inline text objects. Placeholder text will be visible giving an indication of what the condition is set up to test.

 

condinline4

Figure 2: Placeholder text is viewed in each configured condition.

 

4. We will now need to insert a new condition for when the gender is male. Select here to learn how to add new conditions to your section.

 

5. Simply replace the text that is present with the dynamic or static content that you wish to be displayed for each of your conditions. In this example, we are including a message for when the "gender" attribute is set to male, female, and when any other value is present to display a default message.

 

condinline5

Figure 3: The content is added in each of the conditional inline objects.

 

6. Lastly, you should test your results by previewing the output. You can Edit Your Data Source to modify the test value and compare to ensure the behavior is correct. Notice that only one condition is used for the output and that no space will be consumed by the other inline objects that do not evaluate for the condition.

 

condinline6

Figure 4: The output satisfying the condition for the data value set to male.