官术网_书友最值得收藏!

Playing with conditional styles

Assume that the following report needs to be formatted such that quantities below 1.7 million will be highlighted with red background and those above 2 million should be green. Also, we need the negative values for Running Difference (month-on-month) to be shown in red and in brackets as shown in the following screenshot:

As shown in the previous recipe, this would have needed us to define two conditional variables. Then attach each to the corresponding column as Style variable to define the styles. With one more such numeric column, the author had to define one more variable and repeat the exercise. Let's see how the new conditional styling feature solves this problem.

Getting ready

Write a new report similar to the one shown in the previous screenshot.

How to do it...

In this recipe, we are going to examine more ways to enhance the reports look and feel. To do this:

  1. Select the Quantity column on the report page.
  2. Open the new Conditional Styles dialog box from the Properties pane. Alternatively, you can also click on the Conditional Styles button from the toolbar.
  3. Create a new Conditional Style as shown in the following screenshot:
  4. Choose Quantity to base the conditions on.
  5. Define three values (0, 1.7 million, and 2 million) by hitting the new value button in the bottom-left corner. This will look like the following screenshot:
  6. Also, choose corresponding styles for each range as shown in the previous screenshot. Give appropriate names, like Quantity colors in this case.
  7. Similarly, define the negative values for the Running Difference column to be shown in red as shown in the following screenshot:
  8. Run the report to test it as shown in the following diagram:

How it works...

With this feature, we can now define styling for any column without explicitly defining the conditional variable. The styling can be based on the values on the column itself or some other column.

Also, defining actual formatting (font, color, border, and so on) for different conditions is now done within one dialog box. This is more author-friendly than traversing through the conditional variable pane and choosing each condition.

There's more...

The previous example defines very basic value-based range or classification.

You can also choose the Advanced Conditional Style option under this property, which allows you to define an expression and have better control over conditions than just classifying the values into ranges.

主站蜘蛛池模板: 凉城县| 昌都县| 舒兰市| 星座| 红安县| 德令哈市| 社旗县| 华宁县| 彰化县| 金华市| 莱州市| 东辽县| 临夏县| 德昌县| 泗阳县| 故城县| 兴文县| 米易县| 湘阴县| 武陟县| 策勒县| 鸡东县| 峨眉山市| 珲春市| 玛纳斯县| 威远县| 林口县| 天全县| 库伦旗| 于都县| 五原县| 杨浦区| 邵阳县| 广河县| 丰台区| 本溪市| 姜堰市| 岐山县| 深泽县| 衢州市| 晋江市|