One of the most common questions we get asked with Toad Data Point workbook is, how can I combine data that I've queried and potentially cleaned up in workflow 1 with data that I've queried and maybe have or have not cleaned up in workflow 2 to create a workflow 3? So in this example, I have customer and contact data in my first workflow. I have order data in my second workflow. So how would I go about creating a third workflow that combines my customer and contact and order data together?
And there's a couple of ways to do this. I'm going to go through the easiest ways first. So, one of the easiest ways to do this is to add an output into each of your workflows that writes the data out to local storage, and then using local storage as your source for workflow 3. So let me go through that example really quickly.
And by the way, this example works very, very well when you have transformation and cleanse as part of your process. So you'd not only want to query the data, but you want to clean it up, and then it's that cleaned up data that you want to join to other data. And so I'm going to go to this Customer Cleanup here, this step here, and I'm going to add a new child step, and it's an output. And I'm going to output this data into my local storage.
And what that will do for me is it automatically chooses a database that is named the same as my workbook. So Customer Query Demo. So it will either choose this existing database or create a whole new database within my local storage with that name. And I could change it if I wanted to here, but that makes sense to me. So I'm going to leave it the way it is.
And then it's going to go ahead, and it's going to create a table of data within that database. Now, it's going to name it, in this case, just Workflow 1 Local Storage, because it's the first data set that I've saved from workflow 1. But I'm going to go ahead and give this a more meaningful name so it's easy for me to find and utilize later on. So I'm going to call it Cleaned Up Customers Data. Just a little cleaned up cust data.
And I'm going to go ahead and say, OK, let's go ahead and save that data. And then I'm just going to go ahead and generate that output right now. I create this step, but I'm going to let it go ahead and finish and generate that step. And now I'm going to do the exact same thing off of workflow 2. Now, workflow 2, I haven't done any sub-steps. I haven't done any transformation and cleanse of my order data or pivoting off my order data.
So right off of this initial result set, I'm going to go ahead and add an item. And same kind of thing, go to Output and go to Local Storage. Again, it's picking the right database for me. Instead of saying Workflow 2 Local Storage, I'm going to say Raw Order Data. And I'm just using the term raw here because I haven't done any transformation to this order data. And I'm going to go ahead and save that. And just like I did before, I'm going to generate that output.
So now, I can go ahead and create my workflow 3. So I'm going to go to my Customer Query Demo and create a new workflow step. I'm going to build my results set, and I'm going to use my Query Builder. And my source is going to be local storage, because this is where I've saved my data.
And when I go and look in my local storage database, which opened up right here for me, I can see in my Cleaned Up Customer Data, and I can see my Raw Order Data. And in this case, I've got my contact ID in both my systems. That's going to be my join between those two. And I'll just go ahead and pick each one of these. I'm not going to pull the contact ID in twice.
And then I can go ahead and query this data. And you can see it brings it all together in this third workflow step. That's one of the easiest ways that you can do this process of combining workflow segments together in a single data set.