Icon

06. Flow Variables - solution

Flow Variables - Solution

Solution to the exercise 7 for KNIME User Training
- Filtering rows by an attribute value
- Filtering rows by an attribute value that fulfils a condition and that is updated automatically
- Filtering rows based on a user selection
- Creating a component

Activity I: Flow Variables - Filter the customer data to 1. customers of the "Gold Investment" product2. customers of the most common product in the data Activity II: Flow Variables - Create a component that allows a user to choose an investment product and filter the data by that product Activity IV: Flow Variables (optional)Goal: Create a component that allows to select multiple products out of all available products, using a flow variable of type array1. Remove all columns besides the column Products (Column Filter node)2. Remove duplicate rows (Duplicate Row Filter node)3. Transpose the column (Transpose node)4. Aggregate all products into one Cell (Create Collection Column node)5. Create an array flow variable with all products(Table Row to Variable node)6. Create an input option to select multiple products (Multiple Selection Configuration node) Tip: Control the setting option "Possible Choices" via the Flow Variable tab by using the flow variable created in step 5 Activity III: Flow Variables (optional)Goal: Create a path variable that automatically has the current execution date in the file name and write the filtered table into a CSV file.1. Create a flow variable with the execution date (Date&Time Configuration node) Tip: Select "Date" for the setting option type and activate the checkbox "Use execution time".2. Create a flow variable with the file name, including the flow variable with the current execution date (String Manipulation (Variable) node) Tip: Use the expression: join("product-filtered",$${Sexecution-date}$$)3. Create a Path flow variable to save the filtered product file in a directory of your choice, using the flow variable created in 2 as file name(Create File/Folder Variables node)4. Write the filtered table into a CSV file (CSV Writer node) Tip: Use the Path flow variable that you created in 3 filter by Productsby Productsselect product categoryvia Configurationfirst rowCustomer datadesc by countSet executiondateJoin nameand execution dateCreate pathflow variableWrite product typewith execution dateCustomer dataOnly products columnEach productonly onceAggregate valuesin arrayCustomer data Row Filter GroupBy Category Selection Row Filter Value SelectionConfiguration Table Rowto Variable Table Reader Sorter Date&TimeConfiguration String Manipulation(Variable) Create File/FolderVariables CSV Writer Select Product Type Table Reader Column Filter DuplicateRow Filter Create CollectionColumn Table Rowto Variable Transpose Multiple SelectionConfiguration Table Reader ReferenceRow Filter Select Products Activity I: Flow Variables - Filter the customer data to 1. customers of the "Gold Investment" product2. customers of the most common product in the data Activity II: Flow Variables - Create a component that allows a user to choose an investment product and filter the data by that product Activity IV: Flow Variables (optional)Goal: Create a component that allows to select multiple products out of all available products, using a flow variable of type array1. Remove all columns besides the column Products (Column Filter node)2. Remove duplicate rows (Duplicate Row Filter node)3. Transpose the column (Transpose node)4. Aggregate all products into one Cell (Create Collection Column node)5. Create an array flow variable with all products(Table Row to Variable node)6. Create an input option to select multiple products (Multiple Selection Configuration node) Tip: Control the setting option "Possible Choices" via the Flow Variable tab by using the flow variable created in step 5 Activity III: Flow Variables (optional)Goal: Create a path variable that automatically has the current execution date in the file name and write the filtered table into a CSV file.1. Create a flow variable with the execution date (Date&Time Configuration node) Tip: Select "Date" for the setting option type and activate the checkbox "Use execution time".2. Create a flow variable with the file name, including the flow variable with the current execution date (String Manipulation (Variable) node) Tip: Use the expression: join("product-filtered",$${Sexecution-date}$$)3. Create a Path flow variable to save the filtered product file in a directory of your choice, using the flow variable created in 2 as file name(Create File/Folder Variables node)4. Write the filtered table into a CSV file (CSV Writer node) Tip: Use the Path flow variable that you created in 3 filter by Productsby Productsselect product categoryvia Configurationfirst rowCustomer datadesc by countSet executiondateJoin nameand execution dateCreate pathflow variableWrite product typewith execution dateCustomer dataOnly products columnEach productonly onceAggregate valuesin arrayCustomer data Row Filter GroupBy Category Selection Row Filter Value SelectionConfiguration Table Rowto Variable Table Reader Sorter Date&TimeConfiguration String Manipulation(Variable) Create File/FolderVariables CSV Writer Select Product Type Table Reader Column Filter DuplicateRow Filter Create CollectionColumn Table Rowto Variable Transpose Multiple SelectionConfiguration Table Reader ReferenceRow Filter Select Products

Nodes

Extensions

Links