WeeklyAlteryxTips#7 Batch writing to multiple files

Alteryx

I think that this post is well known technique. But this blog is not defined from beginner to advanced. So the advanced user can skipt this post!

For example, you want to sent the divided report to each person. The detail is as follows.

In this case, the simplest way is using the Filter tools and the Output Data tools for each district as follows.

If the salesperson increases, you have to add more and more Filter tools and Output Data tools…It’s very troublesome.

One tool solution!!

It is very easy to solve this problem. All you have to do is use Output tool with certain option.

The option “Take File/Table Name From Field”

The option “Take File/Table Name From Field” is very useful option to save the multiple files at once.

In this example, there is “salesperson” field, so you can set them as the file name to save the separated files.

The setting of Output Data tool is as follow.

  • Take File/Table Name From field

Check this option!!

  • Append Suffix to File/Table Name

When you want to output the data by separated files depending on the specific field value, you can use this option. This result in adding field value to the file name. Suffix means adding the field value after the specific file name.

There are other options. When you use the option “Change File/Table Name”, the entire file name is changes. If you want to save one Excel book with multiple sheets, you can use this option.

The option “Change Entire File Path” is used for saving different Excel books. Note that you have to prepare the entire Excel file path with sheet name using Formula tool.

  • Field Containing File Name or Part of File Name

Select the source field to save the separated files. The Output Data tool save the data with grouping according to the specific field’s value.

  • Keep Field in Output

For exmample, when you don’t need the “salesperson” field, you can uncheck this option. Otherwise, when you need the that field, you should check that option. If you make the entire path for saving separated files, you usually uncheck this option.

In this example, the sample workflow output the files as follows.

The sample workflow is very simple as follows. I use that option so I can delete many Filter tools and Output Data tools.

Sampleworkflow Download

*This workflow uses “Data Science 100 Knocks (Structured Data Processing Edition)” by the Skill Definition Committee of the Data Scientists Association of Japan

Contents of the next blog

I will do the same things for Excel files.

コメント

Copied title and URL