Coloring Report Rows with Color Rules
- Updated on 09 Oct 2013
- 3 minutes to read
Color Rules evaluate the data in a row and color the row when its data meets the rule’s condition. To build a color rule you need to select a rule that has already been created and set the color that will highlight the row. The rule must us a column on the report as an input.
For example, a rule could be created called PNG Rule that evaluates whether a document type is .png . Create a report listing all the folders in the system and all of the documents in those folders. One of the columns on that report, Document Type , could then be used as input for the PNG Rule . Then create a color rule for the report that uses the PNG Rule to evaluate the Document Type against the conditions in the rule, and highlights all of those rows that contain .png in the Document Type field.
To assign a color rule to a report go to the Report Designer and, in the Properties Panel , under the section Colors > Row Color Rules , click the Add button.
The goal of this example is to:
Build a report that contains a Nesting Level column.
Use a created rule to evaluate if the data in the Nesting Level column is equal to 2.
Configure the color rule to highlight rows that meet the rule’s criteria in pink on the report.
Navigate to a Designer Folder , click the Create Report/Page button, and select Create Report .
Give the new report a name and click OK to open it in the Report Designer .
First, add a data source to the report.
Under the category Data Sources column click Add. Go to Common and select Folder Data Source to add it to the report.
Then add columns to the report.
Under the Data Fields category click Add. Select Entity Name , Folder Type Name , and Nesting Level into the workspace.
Then associate the report with the color rule.
In the Properties Panel under the Colors section, select the Use Row Coloring checkbox. This will expand the Colors section. Next, under the section Colors > Row Color Rules , click the Add New button.
Now we have to create a rule. This rule will color the rows that have a Nesting Level of 2. Under Rule Information > Rule, select Create and name the rule Cell Color Rule. Then click OK .
The Rule Editor will open. Under Rule Input Data click the Show Editor link.
Name the input data as Nesting Level and click OK.
Select the Nesting Level data input that we created and click Next.
Now select the Equals condition and click Next.
In the next window enter the number 5 and select Done.
Save and close the rule to navigate back to the Add Row Color Rules window. Under the section Input Bindings select Update Inputs. The input data that we used for our Nesting Level Rule should appear.
Select input for our nesting level and click Edit.
Select the nesting level column in the Report Field drop down list and click OK .
Now that the connection is made between the field on the report and the rule that will evaluate it, the next step is to define the row color for those that meet the rule’s condition (“Nesting Level = 5”).
Click the Background Selector. In the Color Picker popup window select the color and click OK .
The other color settings can be filled if desired, but the color rule is complete. Close the Edit Row Color Rules window.
Save and close the report. Right click the report and select Run Report from its Action menu.
As pictured below the report colors the rows that have a nesting level of 2.