Overview

This is a continuation of part 2 of a series of blogs on tools and tips around them.

Output Tool – Multiple Files

As we work on automating data tasks, we may need to provide output in separate files. This could be due to the fact that there are other systems that take these files as input or input data is categorized in a particular manner.  Alteryx provides simpler options to do this.

Option 2 – Create files based on a field (Excel Output)

I would describe a method that works for Excel files. (For other formats, it is a bit easier and avoids the formula tool step. I would cover that in a different blog post). There could be a business requirement where the files are named based on a field in the input. For example, in the above example,  sales for each region needs to be recorded in a separate file say “Customer Sales East”.

Let’s say we wanted to create separate files for different regions i.e get all the records for a region in a single file with a name using the value in the field “Region.

Step 1:

The example workflow is similar to the following: There are 3 tools in this workflow (1) Input File (2) Formula Tool (3) Output Tool. I would explain the Formula Tool and Output Tool. You can find an explanation for the input tool in part 1 of this blog series.

Alteryx Output Multiple Field Workflow

Step 2:

After adding the input tool and configuring it, add the formula tool to your workflow and configure it as below. Based on the path and filename that you want to use for your output, you can create a new column “Path” and set the path in quotes. Do note, you would need to specify the sheet name using “|||Sales$” if the sheet name is “Sales”. Missing this step will lead to an error. Here the objective is to create different files as per the region. Concatenate the region column with this path string to get the complete path.

Step 3:

Add the output tool to your workflow. Set the output name initially.

Specify the sheet name. These values serve just to avoid errors in the output tool. As you would see, we would be creating files based on the path specified in the formula tool.

Step 4: 

Configure the output file specifications as below. Select the option “Take File/Table Name From Field” and “Change Entire File Path”. In the dropdown for “Field Containing File Name or Part of the File Name”, select the column that was created in the formula tool i.e. “Path”.  The option “Keep Field in Output” is not mandatory. It just keeps the path as a column in the output files.

Step 5: 

Run the workflow. The results window should show an output similar to the one below. As you can separate files were created for different regions.

Step 6:

Verify the results. You can open one of the files to check.

This is an example of a simple but powerful feature for Alteryx. Hope this article helped you in your quest for generating different output files based on a column name.