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

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.

主站蜘蛛池模板: 梓潼县| 前郭尔| 平阳县| 专栏| 屏东县| 丰台区| 温泉县| 陇南市| 赫章县| 阿勒泰市| 积石山| 星座| 株洲市| 诸暨市| 班玛县| 南宁市| 大英县| 宁海县| 平罗县| 商丘市| 富蕴县| 建宁县| 拜城县| 泰安市| 镇沅| 沙洋县| 安新县| 唐河县| 镇宁| 涿州市| 乐至县| 桑植县| 顺平县| 西丰县| 宁化县| 光泽县| 秦安县| 城市| 黑龙江省| 广汉市| 金堂县|