I. Overview
1. Expected effect
For the data in the data column, a column of data is displayed in a list. If the adjacent cell data is the same as the error data, you need to highlight the background of the cell with the same data. The effect is as shown in the following figure:
2. Implementation ideas
Use the level coordinate formula in the condition attribute to get the previous value and the next value of the current cell. If the current value is equal to the previous value or the next value, the background of the current value is red.
II. Example
1. Prepare data
Create a new general report, create a new embedded data set, and design the table as shown in the figure below:
2. Design table
Drag the data columns into the cells respectively, and the table style is as shown in the figure below:
And A1 cell should be set to List, as shown in the figure below:
3. Add conditional attributes
Select cell A1, add conditional formatting, select Background from the drop-down attribute, click Edit to customize the color, and set it toCurrent Cell. Select Common as the condition type, and add two conditions, which are equal to formula A1[A1:+1]and equal to formula A1[A1:-1]. Connect the two conditions with 'or'.
Formula description:
A1[A1:+1]: means to get the value of the cell above the current cell.
A1[A1:-1]: means to get the value of the cell below the current cell.
Note: The example shows that the data expanded vertically means that the upper and lower cells are the same. If the data is expanded horizontally and the left and right cells are the same, the highlighting can refer to Relative and Absolute Coordinates.
The steps are shown in the figure below:
4. Effect preview
1) PC terminal
Save the report, click Pagination Preview, the effect is shown in Section I.1 .
2) Mobile terminal
Both App and HTML5 are supported, and the effect is shown in the figure below:
III. Template download
Please refer to the completed template:
%FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\FeaturesApplication\Highlight when adjacent cells have the same value.cpt
Click to download the template: Highlight when adjacent cells have the same value.cpt