Let's suppose that I want to create a report with data from a certain group of items, for example orders from all valuable customers. For sake of clarity, I would like to have each page of the report dedicated to each customer's list of orders. The report then will have a variable number of pages, for example 10 today for today's 10 most valuable customers and 100 for next month's most valuable customers. How can I implement that with the KNIME Reporting tool?
First of all, in a workflow create a data table with the order lists. Each order listbelongs to a specific customer who's uniquely identified. Then create the list of customers. Export both tables to the report with a "Data to Report" node.
Now create the report. In the report layout, use a table to host the report pages. This table should be binded to the data set containing the customer list.
In the "details" cell (the data cell) of the table shape the page of your report as you would like it to be. In particular, introduce a second table and bind it with the data set containing the list of orders.
Now the trick. In the table with the order list, in the "Property Editor" panel on the bottom, select the tab named "Filters", and introduce the following filtering condition:
row["custID"] Equal to row._outer["CustID"]
row._outer["CustID"] represents the field "CustID" of the external table.
If you use the option "Build Expression" for the second term of the filtering rule, in the bottom panel for the category "Available Column Bindings" you should see two tables: one is the order list table and one is the container table. Select the "CustID" field of the container table (you can recognize it by its fields), and the "CustID" field.
Add a Page Break at the end of the data row of the external table.
This filtering rule selects only the data for one customer for each data row of the external table. The result is a page for the data of each customer and a variable number of pages.