Icon

11_​Workflow_​Control_​Solution

Workflow Control - Solution

Solution to exercise 11 for the KNIME Analytics Platform for Data Wranglers course
- Write subsets of a file using a loop
- Read and concatenate many files using a loop
- Activate a workflow branch based on a user selection

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" (Single Selection Configuation node) - Use the CASE Switch Data (Start) that activates the top/middle branch depending on the selection scatter/bar (Use the "...(index)" flow variable to define the activeport)- Combine the outputs of the two branches with the CASE Switch Data (End) node Activity I: Write Multiple Excel Sheets into an Excel FileGoal: 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 Start node - Close and execute the loop (Variable Loop End node) Activity II: Concatenate Multiple Excel SheetsGoal: Create a loop that reads and concatenates all the sheets in an Excel file. - Create a table that contains all sheet names (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 Flow Variable tab - Close the loop and concatenate the tables from the different iterations (Loop End node) Read CurrentDetailDataRead entire tableRecords of onegroup per iterationCombine all sheetsinto single tableCombine pathesinto oneSelect baror scatterCollect variablesand end loopWrite recordsof current iterationinto an Excel SheetCreate table withall sheet namesRead one sheet perinterationLoop overall sheet names Table Reader Image To Table Image To Table Table To Image Scatter Plot Bar Chart Table Reader Group Loop Start Loop End CASE SwitchData (Start) CASE SwitchData (End) Single SelectionConfiguration Variable Loop End Excel Writer Read ExcelSheet Names Excel Reader Table Row ToVariable Loop Start 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" (Single Selection Configuation node) - Use the CASE Switch Data (Start) that activates the top/middle branch depending on the selection scatter/bar (Use the "...(index)" flow variable to define the activeport)- Combine the outputs of the two branches with the CASE Switch Data (End) node Activity I: Write Multiple Excel Sheets into an Excel FileGoal: 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 Start node - Close and execute the loop (Variable Loop End node) Activity II: Concatenate Multiple Excel SheetsGoal: Create a loop that reads and concatenates all the sheets in an Excel file. - Create a table that contains all sheet names (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 Flow Variable tab - Close the loop and concatenate the tables from the different iterations (Loop End node) Read CurrentDetailDataRead entire tableRecords of onegroup per iterationCombine all sheetsinto single tableCombine pathesinto oneSelect baror scatterCollect variablesand end loopWrite recordsof current iterationinto an Excel SheetCreate table withall sheet namesRead one sheet perinterationLoop overall sheet names Table Reader Image To Table Image To Table Table To Image Scatter Plot Bar Chart Table Reader Group Loop Start Loop End CASE SwitchData (Start) CASE SwitchData (End) Single SelectionConfiguration Variable Loop End Excel Writer Read ExcelSheet Names Excel Reader Table Row ToVariable Loop Start

Nodes

Extensions

Links