pkaiser

Conditional Formatting in Tabular Web Parts

Blog Post created by pkaiser Employee on Jul 6, 2009

One of the more advanced features of PI WebParts is to allow the creation of a named set of appearance and behavior characteristics for many of our web parts. Called "Advanced Configurations", these named sets of appearance and behavior characteristics can be created for RtMessenger, RtTrend and RtXYPlot, and for the tabular web parts: RtTable, RtValues, and RtTimeSeries. Advanced configurations are created using the administrative web site.

 

Conditionally changing the foreground and background colors for a dataset column is one of the more powerful options of advanced configurations for tabular web parts. As of version 2.1 of RtWebParts, any number of conditional format specifications can be added to a single dataset column. These specifications are evaluated in order, from top to bottom, and the first specification whose condition is satisfied is applied for the applicable column for each row in the dataset.

 

There are two subtle points to note about conditional format specifications. First, both operands in the comparison can be column values, even though the second operand is entered with a text box instead of selected from a list of known columns. To compare one column value to another, select the first column in the first operand pull-down, then select the operator, then for the second operand use the "col()" function, with an argument of the column name. The second subtle point follows from the first, and that is that the condition applied to a column does not have to be based on that column's value. In other words, when specifying the condition, none of the operands have to be the column that is being conditionally formatted.

 

As an example, imagine a dataset with three columns: A, B and C. You can create an Advanced Configuration for the tabular web parts that will change the foreground and background colors of the cells in column A based on comparison of the values of columns B and C in that same row.

 

 condformatexample.PNG

Outcomes