Icon

08. Workflow Control - Exercise

Workflow Control - Exercise

Exercise 9 for KNIME User Training
- Handling groups of data in separate iterations where the groups are defined by values in one or more columns
- Reading and concatenating many files
- Activating a workflow branch based on a user selection

Activity II: Concatenate Multiple Excel Sheets Goal: Create a loop that reads and concatenates all the sheets in an Excel file. - Create a table that contains all sheet names of the Excel file created in Activity I (Read Excel Sheet Names node) - Start a loop that iterates over the sheet names (Table Row to Variable Loop Start node) - Read the Excel sheet with the sheet name in the current iteration (Excel Reader node) Tip: Use the flow variable created by the Table Row to Variable Loop node to control the setting sheet_name in the FlowVariable tab - Close the loop and concatenate the tables from the different iterations (Loop End node) Activity I: Write Multiple Excel Sheets into an Excel File Goal: Build a loop that will create an Excel file with separate Excel sheets for the records of different products. - Read the table CurrentDetailData.table (Table Reader node) - Start a loop that handles the records for the different products in separate iterations (Group Loop Start node) - For each product write one Excel sheet into a single Excel file (Excel Writer node) Tip: Control the flow variable sheet_name in the Flow Variable tab by using a flow variable created by the Group Loop Startnode - Close and execute the loop (Variable Loop End node) Activity III: CASE Switch Extend the workflow below with a switch that only creates one type of visualization. - Create a Single Selection Configuration node with the possible values "scatter" and "bar" - Drag the CASE Switch Start node, and Click on the three dots on bottom left corner of the node to add input port as Table, usethis node to activate the top/middle branch depending on the selection scatter/bar (Use the "...(index)" flow variable to define theactive port)- Combine the outputs of the two branches with the CASE Switch End node, you can add the output port as Table to this node byclicking on the three dots and then adding output port. Read CurrentDetailData Image To Table Image To Table Scatter Plot Bar Chart Table Reader Activity II: Concatenate Multiple Excel Sheets Goal: Create a loop that reads and concatenates all the sheets in an Excel file. - Create a table that contains all sheet names of the Excel file created in Activity I (Read Excel Sheet Names node) - Start a loop that iterates over the sheet names (Table Row to Variable Loop Start node) - Read the Excel sheet with the sheet name in the current iteration (Excel Reader node) Tip: Use the flow variable created by the Table Row to Variable Loop node to control the setting sheet_name in the FlowVariable tab - Close the loop and concatenate the tables from the different iterations (Loop End node) Activity I: Write Multiple Excel Sheets into an Excel File Goal: Build a loop that will create an Excel file with separate Excel sheets for the records of different products. - Read the table CurrentDetailData.table (Table Reader node) - Start a loop that handles the records for the different products in separate iterations (Group Loop Start node) - For each product write one Excel sheet into a single Excel file (Excel Writer node) Tip: Control the flow variable sheet_name in the Flow Variable tab by using a flow variable created by the Group Loop Startnode - Close and execute the loop (Variable Loop End node) Activity III: CASE Switch Extend the workflow below with a switch that only creates one type of visualization. - Create a Single Selection Configuration node with the possible values "scatter" and "bar" - Drag the CASE Switch Start node, and Click on the three dots on bottom left corner of the node to add input port as Table, usethis node to activate the top/middle branch depending on the selection scatter/bar (Use the "...(index)" flow variable to define theactive port)- Combine the outputs of the two branches with the CASE Switch End node, you can add the output port as Table to this node byclicking on the three dots and then adding output port. Read CurrentDetailData Image To Table Image To Table Scatter Plot Bar Chart Table Reader

Nodes

Extensions

Links