WeeklyAlteryxTips#3 Multiple file read #3

Alteryx

The third Weekly Blog is a continuation of the first and second Blog on loading multiple files in the Data Input tool.

In the previous post, I explained how to load the multiple files with the same schema, but I would like to explain about loading files with the different schema this time.

Read multiple files with the different schema at once

To begin with, I would like to conclude that a batch macro is required.

The batch macro is a type of macro that executes the same workflow repeatedly for the number of records entered into the Control Parameter tool. Because of the repetitive execution, the data loaded by the
Data Input tool is handled independently each time and can be loaded without regard to schema differences between multiple files (but certain options must be turned on).

To learn the batch macro, you can refer the learning contents “Interactive Lesson” in the Community.

Let’s look the sample workflow.

Use batch macro to read files with different schemas at once

I will build on the workflow based on AlteryxWeeklyTips Week 2. I change the Dynamic Input tool part into a batch macro.

For CSV files

You have to make the Batch macro as follows:

There is no setting at Control Parameter tool and Macro Output tool. You have to set the setting the Data Input tool to load the files correctly.

Regarding the Macro type, when you put the Control Parameter tool to the canvas, the macro type is automatically changed to the Batch Macro.

You have to set the Action tool as follows.

  • Select an action type : Update Value
  • Value or Attribute to Update : File-value

The important point is to open the Interface Designer and select the “Auto Configure by Name” option at the “Output Mode”. This way, the outputs are finally grouped according to field names.

“Output Mode” is set as “All Iterations will hae the same output schema” by default, however in this case you can not use this option because you want to load the files with different schemas.

After that, you need to change to the batch macro from the Dynamic Input tool.

Now it is done!

For Excel files

In the case of Excel files, you have to load an Excel file in the Data Input tool when creating the batch macro.Other than that, there is no difference from CSV way. This is because we created the paths to the Excel files in the Formula tool at the WeelkyTips #2.

That is, specifically, this part.

Sample workflow download

Contents of the next blog

In the next post, I will explain the multiple sheets loading in Excel files.

コメント

タイトルとURLをコピーしました