In today’s blog post we’re going to walk-through how-to time stamp your data in Knime. But Nick, why would we ever want to time stamp our data you say?
We’ll the biggest reason we’d want to do such a thing is to build a data repository over time that we can look back and analyze. For example, if we’re Amazon seller’s, we might want to understand how many days our processes take on average to get an order from paid, to marked ready for shipping, to out the door and delivered to our end customers. This type of insight from our data can help us understand where our soft spot is, so we can focus improvement there, and ultimately provide an elevated shopping experience for our customers. But, to be able to track this, we need to timestamp our data and our processes.
Now that we’ve cleared that up, lets dive into the tutorial. To get started, I will be using data from the below pictured workflow:
The data here has been processed so that a customer service team member (from the above example) can upload the output to Amazon’s servers and link Tracking numbers to the respective orders.
Our goal will be to add a time stamp to this data. The date needs to be based on the date & time of running the workflow, so we can’t simply hardcode today’s date into the data.
We have two options to dynamically create the date stamp, we can use either the “Create Date&Time” node or we can use the “Column Expressions” node. In this example, we’re going to use the Column Expressions node, since it’s the easiest to implement.
As a side note, the Column Expressions Node is one of my favorite nodes because of its ability to handle a wide variety of manipulations along with its ability to execute logic-based manipulations. You can learn more on the column expressions node in this video on my YouTube channel.
Let’s get started! We can find the Column Expressions node in the Node Repository simply by searching “Column Expressions” and dragging and dropping onto our workflow.
After we make our connection, we can double-click into the node to start our configuration. This is what the configuration menu looks like:
The menu is rather straight-forward, simply click on the plus sign in the top left to create a new expression. Adding an expression gives us the option to create the expression, set the expression’s column type (string, number, date etc.), create the expression’s output as a new column or replace an existing column with the expressions output. Below is what the configuration menu looks like after we’ve clicked the plus sign and added an expression.
In the lower portion of the configuration menu we can see the expression editor. This expression editor is where we’ll write a little bit of code (don’t be intimidated, you’ll see how easy it is to setup) that’s executed to create the output we’re looking for.
Right above the expression editor are three drop-down options labeled “column”, “variable”, and “function”. These help us write out our code in the expression editor, you simply double-click on the value and its drops down into the expression editor.
For our tutorial we’re going to use a date function, so we’ll click on the function list and search for the “today()” function at the bottom of the list. Once you we find it, we can double-click on the function and it should appear in the expression editor. Next, we’ll adjust the options on the top end on the menu: set the column type to local date and set the column name to “Date Processed”.
Our column expressions node is now configured and ready to be executed. Yes, it’s that easy to setup. We can click apply and ok to close out the configuration menu. Then we’ll right click on our node and select execute. Our output data should look like the screen shot below:
That’s all there is to it, our data is now date stamped! The date stamp gives us the ability to look back over time and audit our processing times on this specific step of the customer journey. This insight will help us keep our operation running smoother which in turn helps provide our customers the best possible experience when they shop with us!
If you’re interested in applying similar metrics and datapoints to your data, don’t hesitate to reach out for personalized consulting.