The zebra-style helps reading the table and makes the table look good. But how can we add some additional information to the row background color? For example, how can we display in green (red) those rows where the present sales amount is greater (smaller) than the sales amount of the previous year?
First, in the KNIME workflow let’s insert a “Math Formula” node between the “File Reader” and the “data To Report” node to calculate the ratio between the amount of sales for this year and the amount of sales for last year in the same month. The formula used to calculate the new column called “ratio” is:
($present$-$prev. year$)/$prev. year$
Let’s now switch to the report and create a new table from the new dataset.
In the report layout:
o Select the data row of the table.
o In the “Property Editor” below:
§ Select the “Highlights” tab.
§ Click the “Add” button to add a new Highlight for the data row. The “New Highlight” window appears.
§ In the “new Highlight” window:
- In the “Condition” frame:
o In the first Textbox, select column “ratio”
o In the second Textbox, select “Greater than”
o In the Third Textbox, Write “0”
- Define the consequent format. For example, “Background Color:” “Green”.
- Click the “OK” button.
§ Repeat the operation for “ratio” “Less than or equal” “0” and “Background Color” “Red”.
Run a “Preview” to see your table in red and green rows.