This workflow aims to demonstrate the use of the Expressions node for data manipulation, including string and integer operations, and to highlight the power of combining AI techniques.
You can download and run the workflow directly in your KNIME Analytics Platform. We recommend using the latest KNIME AP version for optimal performance.
We are using a fake dataset to show e-commerce performance metrics.
Workflow Details:
Below is how we have used the Expression node within the workflow.
Age Bucket Creation
First, we create an age bucket using an IF condition, following the example provided by the node IF expression.
Expression Node and K-AI Assistant
We use the Expressions node with K-AI (KNIME Assistant) to generate regex patterns for extracting data. Remember to install the AI assistant extension to use this feature. We provide the assistant with two different prompts to achieve the desired results:
Prompt Product ID:
"Generate a regular expression to extract the Product ID from the URL column.
Example:
URL: https://www.fakeecommerce.com/electronics/fire/9b39b2b4-b6a6-418e-a994-8b1c0aad8a54?source=Google
Product ID pattern: b39b2b4-b6a6-418e-a994-8b1c0aad8a54"
Prompt Product Category:
"Generate a regular expression to extract the Product category from the URL column.
The product category is always the first element of the URL pathname."
Data Transformation
Perform a join operation and apply title case formatting to the Product Category and Age Bucket columns.
Revenue Calculations
Perform mathematical operations to calculate the percentage of revenues.
Finally, with the Table View node, it is possible to visualize the final data.