For Text and Text Box widgets, it is possible to define rules that allow you to display different text based on the data. Click the Edit text rules button in the text editor toolbar that shows above the widget when you are editing the text – this will open the Edit text rules window.
We will use an example taken from this report showing data from the US Census Bureau. The demographics section shows a paragraph of text that compares the value for the selected feature with that of a comparison feature (United States).
If Alabama is the selected feature, the paragraph shows the word “lower”.
Whereas if California is the selected feature, the paragraph shows the word “higher”.
The words “lower” and “higher” are determined by a text rule. When the widget is edited, the Edit text rules window contains two rules. The first rule is shown below. It defines that the text will show the word “higher” if the data in the widget matches the rule i.e. the population change value for the selected area is higher than that for the United Sates. The value in the first box is #IVALUE{Population Change|2010}. The operator chosen in this case is greater than (>). The value in the third box is #IVALUE{Population Change|2010,C:US}. The forth box applies a multiplier of 1 (in some cases it is useful to be able to apply a different multiplier). If you are not sure how the substitution variables work, you can find more detail in our Variables page.
If the data in the widget does not match the first rule, Report Builder will move on to the next rule. The second rule is shown below. It defines that the text will show the word “lower” if the data in the widget matches the rule i.e. the population change value for the selected area is lower than that for the United Sates. The values in the first and third boxes are the same as for the first rule, but the operator is now less than (<).
If the data in the widget does not match the second rule, Report Builder will move on to the next rule. As in this case there are only two rules, Report Builder will move on to the fallback text. The fallback text is shown below.
You can create add as many rules as you need. There are lots of other operators available to suit different data and scenarios.