Inline Conditions

Top Previous Topic Next Topic  Print this topic

An inline condition is an inline element that is displayed only if a certain condition (derived from the input data) is met. In other words, the element is only rendered if the expression evaluates to a true value. It is the inline equivalent to the Conditional Section.

 

To understand better consider an example of XML with a collection of CDs. You can display for example sections that fulfill a certain condition (for example title and artist of the albums having prices over 10$ or having a certain year of appearance).

In order to do that you need to create a repeating section first because you need for the condition to be tested for each CD.

 

Go to the Insert tab and choose Repeating Section from the Dynamic Content group. The Edit Expression dialog will be displayed. Select the path to the node you refer (in this example cd) and click OK.

 

inline_conditions1

 

In the repeating section insert an inline condition using the Insert tab.

 

The Edit Expression dialog will be displayed again. Choose the condition for your inline section (for example price>10) and click OK. We are going to add an asterisk next to all the items with a price higher than $10.

 

Here is what it should look like when you create the inline condition:

 

inline_conditions2

 

As you can see you have 2 sections you can edit and these are: first one in case of a true value for the condition and the second (a fallback section) in case the condition is evaluated to a false value.

 

If we write an asterisk in the first section and nothing in the fallback, we will get the following result when rendering to PDF:

 

inline_conditions3