Introduction

This guide describes the KNIME Reporting Extension, and shows how to create simple and advanced reports.

The KNIME Reporting Extension allows you to create static reports based on the results of your workflows. You can automatically generate and distribute customized reports for recurring events such as month-end close, quarterly performance, or on-demand statistics. For instance, you can send a PDF email report based on your data.

To visualize your results, you can include nodes from the KNIME Views Extension.

Install KNIME Analytics Platform

The Reporting Extension is included in the default installation of KNIME Analytics Platform version 5.2 or higher. It is recommended to download and install the latest version of the KNIME Analytics Platform. To do so, please refer to the KNIME Analytics Platform Installation Guide.

Working with the Reporting Extension in KNIME

In the following section, you will recreate the Reporting minimal example workflow.

This workflow demonstrates how to access and visualize data that is converted into a report with nodes from the KNIME Reporting Extension. If you have not already done so, you can download the resulting workflow from the KNIME Community Hub and reference it as needed.

As a starting point, you are provided with a basic data table. First, you want to access and visualize the data.

Step 1: Read the data

Download the .csv file from here. Then drag the .csv file on the workflow canvas. This will automatically open and configure a CSV Reader node.

Step 2: Add views to your workflow and create a component

Add views

A crucial part to conveying a comprehensible overview of your data to the end user is visualization. To do this, you can use the nodes from the KNIME Views Extension. They integrate directly with the KNIME Reporting Extension.

In order to display the world population data, you can choose the chart that best fits your data. In this example, to visualize the data you can use a bar chart and view the population per country in a table.

To add the views, drag a connection to your workflow canvas. In the quick node insertion panel, locate the Bar Chart node and add it to your workflow. Repeat this step for the Table View node. Finally, your workflow will look like the one in Figure 1.

03 add bar chart and table view nodes
Figure 1. Add view nodes to your workflow
View nodes from the KNIME JavaScript Views Extension or the KNIME Plotly Extension are not directly supported by the KNIME Reporting Extension.
Add rich text to your report

The KNIME Views Extension also allows you to add text to your report. Search for the Text View node and then, drag it to your workflow canvas. Right click it to open the configuration dialog. It shows a preview of the text. You can manipulate it in the Rich Text Content editor on the right. At the top of the editor you can choose between the following formatting options (from left to right), as shown in Figure 2.

03 text view configuration dialog
Figure 2. Text View configuration dialog
Text formatting

You can change the text formatting to:

  • Boldening (Ctrl B)

  • Italic (Ctrl I)

  • Underlined (Ctrl U).

Additionally, you can add bullet points, create a list and align your text (to the left, right, or center).

Click the 16 icon to open a dropdown menu, which gives you access to more customization styles like adding code blocks or dividers to the text. The text style element also allows you to write in standard or small text, and to create headings. Alternatively, you can create a heading by adding number signs (#), followed by a space, in front of a word or phrase. The total amount of number signs should correspond to the heading level.

Flow variables

The contents of flow variables can be inserted by using the replacement syntax $$["flow-variable-name"].

Create a component

Fundamentally, the report you are creating consists of a component’s composite view. To include the view nodes in your report, wrap them in a component. First select the nodes, then click the Create component button in the toolbar at the top. Open the component by double-clicking it while holding down the Ctrl key, or right-clicking and choosing ComponentOpen component. The sub-workflow contained by the component is displayed.

Open the layout editor

To customize the composite view, use the layout editor. Select Open layout editor from the toolbar at the top. The layout editor will automatically create a layout, but it also allows you to customize it with a drag and drop grid. If you want to resort the order of the view elements, you can simply drag and drop them to the desired position. This is explained in further detail in the KNIME Components Guide.

In the layout preview the height of the Text View node is calculated depending on its content, but can be adjusted in the drag and drop grid. Click the cog icon in the upper right corner of the section corresponding to the Text View visualization node, as shown in Figure 3.
03 text view customize in layout editor
Figure 3. Customize the size of the text view in the layout editor

Enable the reporting function

To enable the component to output the views for a report, tick the Enable Reporting checkbox at the bottom of the layout editor and click Finish, as shown in Figure 4.

03 enable reporting
Figure 4. Enable the reporting function by ticking the checkbox

This creates a Report input and a Report output port to your component. They will be visible as blue squares adjacent to the component once you exit it, as shown in Figure 5.

03 component report output and report input port
Figure 5. Component with Report input and output ports

However, before you can execute the component, please proceed to Step 3: Customize the template of your report.

Step 3: Customize the template of your report

Before you can connect your component views to a reporting node, you need to customize the page size and orientation using the Report Template Creator node. Add it to your workflow and connect its output port to the existing Report input port on the left side of the component. Now your workflow should look like the one shown in Figure 6.

03 report template creator node
Figure 6. Report Template Creator node

Configure the Report Template Creator node to select the page size and orientation, as shown in Figure 7.

03 report template creator configuration dialog
Figure 7. Report Template Creator configuration dialog

Confirm with Okay and execute the component. Now you can preview the output of the component by clicking the magnifier icon at the top right corner of the component.

If you want to add a second page to your workflow, use the Report Page Break node. It prevents your views from being cut off at the end of a page in your report file. You can find the Report Page Break node in the node repository. Add it in between two components to separate their contents with a page break on the report, as shown in Figure 8.

03 add page break
Figure 8. Add page break

Step 4: Write to file

In order to share the previously created content as a document, you need to save it to a file first. From the Report output port of the component creating the report, you can drag a connection and select compatible writer nodes. You can save your report as either a PDF or HTML file.

Make sure that the Enable Reporting checkbox at the bottom of the component’s layout editor is selected and that a Report Template Creator node is connected to your component, as described in the previous steps. Otherwise, you cannot write the report to a file.

To save your report as a .pdf file, add the PDF Writer node to your workflow. This node allows you to write your report to a PDF file in a specified output location. By default on Windows, this is the user directory on your local computer, with the filename set to “report.pdf”, as indicated by the filepath below:

C:\Users\<username>\report.pdf

However, you can change the location path in the configuration dialog, e.g., to your workflow data area. This can be an operating system-dependent path on your local machine or a KNIME URL, as shown in Figure 9. You can also rename the PDF file as part of the filepath. Once executed, the file is saved to the specified location. If you make any changes to the workflow and want to overwrite the existing file, change the If output file exists setting from the default Fail to Overwrite, as shown in Figure 9.

03 report pdf writer configuration dialog
Figure 9. Report PDF Writer configuration dialog

To access the PDF file, navigate to your KNIME workspace in the file explorer. If you have chosen to save your report as indicated in Figure 9, open your workflow folder and then the “data” subfolder. Here you will find your report in PDF format under the name you specified before.

To save your report as an HTML file, follow the same steps as before, but instead of adding the Report PDF Writer node, use the Report HTML Writer node.

Share your report

Once your report is finished you have the option to share it with others. For example, you can send it by email, as shown in this example workflow on the KNIME Hub.

For an overview of the extension, example workflows, and other resources, visit the collection page on the KNIME Hub.