dcsimg

MSSQL Server Reporting Services: Black Belt Components: Ad Hoc Conditional Formatting for OLAP Reports

December 20, 2004

About the Series ...

This article is a member of the series MSSQL Server 2000 Reporting Services. The series is designed to introduce MSSQL Server 2000 Reporting Services ("Reporting Services"), with the objective of presenting an overview of its features, together with many tips and techniques for real-world use. For more information on the series, as well as the hardware / software requirements to prepare for the exercises we will undertake, please see my initial Database Journal article, A New Paradigm for Enterprise Reporting.

Basic assumptions underlying the series are that you have correctly installed Reporting Services, including Service Pack 1, along with the applications upon which it relies, and that you have access and the other rights / privileges required to complete the steps we undertake in my articles. For details on the specifics of the adjustments necessary to quickly allow full freedom to complete the exercises in this and subsequent articles, as well as important assumptions regarding rights and privileges in general, please see earlier articles in the series, as well as the Reporting Services Books Online.

This article also relies upon MSSQL Server Analysis Services ("MSAS") for a sample cube that will be used as a data source by the report with which we work in our practice exercise. For information surrounding the installation of MSAS and the sample OLAP databases and cubes that accompany the typical installation of MSAS, see the associated Books Online.

About the BlackBelt Articles ...

As we have stated in earlier BlackBelt articles, one of the greatest challenges in writing tutorial / procedural articles is creating each article to be a freestanding document that is complete unto itself. This is important, because it means that readers can complete the lesson without reference to previous articles or access to objects created elsewhere. When our objective is the coverage of a specific technique surrounding one or more components of a report, a given administrative function surrounding all reports, and other scenarios where the focus of the session is not the creation of reports, per se, can be challenging because a report or reports often has to be in place before we can begin to cover the material with which the article concerns itself.

The BlackBelt articles represent an attempt to minimize the setup required in simply getting to a point within an article where we can actually perform hands-on practice with the component(s) under consideration. We will attempt to use existing report samples or other "prefabricated" objects that either come along as part of the installation of the applications involved, or that are readily accessible to virtually any organization that has installed the application. While we will often have to make modifications to the sample involved (we will actually create a copy, to allow the original sample to remain intact), to refine it to provide the backdrop we need to proceed with the object or procedure upon which we wish to concentrate, we will still save a great deal of time and distraction in getting to our objective. In some cases, we will still have to start from scratch with preparation, but my intention with the BlackBelt articles will be to avoid this, if at all possible.

For more information about the BlackBelt articles, see the section entitled "About the BlackBelt Articles" in BlackBelt Components: Manage Nulls in OLAP Reports.

Overview

Over the years that I have spent implementing enterprise Business Intelligence applications, I have found many uses, ranging from "simple to sublime," for conditional formatting. At its most basic, conditional formatting can be used to identify exceptional data in a report. Examples (in the world of the sample FoodMart organization) might include Products that sell over or below certain thresholds, or Employees who have been around for a period exceeding a certain number of years.

Conditional formatting is obviously more intelligent than standard, or "absolute," formatting, where the format that is added to a text object, a field of numbers, or other report object remains fixed regardless of the values being printed or displayed. With conditional formatting, Reporting Services evaluates the object to which it is applied, and formats the object based upon its value. The most common example that comes to mind is to print or display negative numbers in red, or enclosed in parentheses / brackets (something with which I have a more than passing familiarity as a recovering CPA). However, Reporting Services can do far more sophisticated conditional formatting with numbers, strings, and a host of other objects.

In Reporting Services, like any of the other enterprise reporting packages on the market, we create what is conceptually a condition, or conditions, to which we assign rules of behavior, consisting most often of a presentation style, but certainly not limited to that. When a value, or other report object, meets the criteria of the condition(s) we define, Reporting Services applies the formatting or other behavior to the object.

In this article, we will introduce conditional formatting in a basic application, and then add a twist: We will practice the hands-on creation of parameterized conditional formatting that will allow users to make runtime decisions surrounding the formatting in their reports. Subsequent BlackBelt articles will focus on more advanced conditional formatting, often in combination with parameters and other components, and especially within the context of providing a "real world" solution that I can share from my own experiences with my readers, who can then implement the concepts in custom-fit manner in their own implementations. Whether my articles show you how to do something you always wanted to do, and your searches of various keywords led you here, or if you're a casual reader who obtains an idea that had not even occurred before exposure to the article, I am confident that you will find that Reporting Services stands ready to meet your needs - probably with multiple options and means of approach.

While we will deal in this article with an OLAP report, ad hoc conditional formatting can be accomplished in similar ways in reports based upon relational sources. (As I have noted in other articles, my tendency is to focus on OLAP reporting, because, while references abound that teach reporting for relational sources in Reporting Services, virtually no references to OLAP reporting exist, at the time of this writing, in any of the new books that have recently appeared. Articles on the subject are also universally sparse - as is often the case for those topics surrounding a new application that are not specifically spoon-fed from its online documentation.) In this session, we will:

  • Make structural changes to a copy of a sample report, based upon a sample cube, to meet the business requirements of a hypothetical group of information consumers;
  • Create a condition whose criteria will be applied to report objects at run time;
  • Create a parameter, with which we will associate conditional formatting, to provide information consumers the ad hoc capability to apply conditional formatting;
  • Discuss the results obtained with the development techniques that we exploit;
  • Preview the report to ascertain the effectiveness of our solution.







The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers