Icon

10. Flow Variables_​Exercise

Flow Variables - Exercise

Exercise 10 for the KNIME Analytics Platform for Data Wranglers course
- Filter rows by an attribute value
- Filter rows by an attribute value that fulfils a condition and that is updated automatically
- Filter rows based on a user selection
- Create 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 Customer dataCustomer dataCustomer dataCustomer data Table Reader Select Product Type Table Reader Table Reader Table Reader ReferenceRow Filter 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 Customer dataCustomer dataCustomer dataCustomer data Table Reader Select Product Type Table Reader Table Reader Table Reader ReferenceRow Filter

Nodes

Extensions

Links