This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Alteryx does a great job of simplifying our business processes, eliminating the need to maintain, document, and use Excel Macros. However, for that one workbook with 100’s (or even 1000’s) of lines of VBA code + months of development behind it, we have a simple way to integrate that Excel Macro within your workflow. This can greatly ease the transition from Excel to Alteryx and save you rework or buy you time to convert the process.
"Error: Designer x64: The Designer x64 reported: Error running Event #1: The external program "C:\Program Files\Alteryx\bin\AlteryxEngineCmd.exe" returned an error code: 2: The system could not find the environment option that was entered. (203)"
Python tool is not able to create misc files (JSON, YXDB) in the temporary location if the workflow is stored in a file path that is too long. This fails when running the workflow via the command line as the temporary location is created in the workflow location.
Robocopy is a robust Windows Command Prompt utility for copying files from one location to another. Unfortunately, it uses exit code 1 to indicate success which Alteryx interprets as an error.
The Run Command tool is a great way to take your workflow to the next level of efficiency. It allows you to interact with the command line directly, just as you would if you were to access it manually and type in a command. Which is great because sometimes we have a lot of important things to do in the command line.
Ladies and Gentleman, I introduce to you the beautiful functionality of the Run Command Tool.
With this trick, you never have to go into the directory to manually open the saved file again.
One of the biggest reasons why people love Alteryx is that it has the ability to read a very large number of different data sources. This article includes a workflow that is able to read in non-natively supported formats like a Word doc or pdf by using a open source program to convert these formats to plain text.
One of the many great things about Alteryx is how it can assist the user in organizing their data not only within the tool, but outside of the tool as well. In this series we will show you how to rename, move, and delete input files that you use in your Alteryx Workflows. You will create batch files with Alteryx that you will later be able to use in a workflow that runs the file. This will give you the ability to stay organized as to what you have run through the workflow.
The first one we will go over is Renaming Spreadsheets.
Renaming Files
Creating the Batch file workflows:
Tools needed in order of use: (1)Directory Input, (2)Select, (3)Formula, (4)Summarize, (5)Output Tools.
Directory Tool (1) –
Browse to the file or files you are looking to change
Select Tool (2) –
Fields you will need are Fullpath, Directory, and File Name
Formula Tool (3) – Output Fields Created: New File Name, Command, and Batch File.
Create a new field, New File Name (String) – Create the new name either by adding a name with quotes around it, from a field, or in like the example below, adding the runtime date of the file to the file name.
Sample Expression of adding the run Date from Directory Tool as the renamed file:
Replace(left([FileName],findstring([FileName],'.'))+' '+tostring(DateTimeNow())+'.xlsx',':','-')
Sample Output - $200 2016-03-04 09-00-43.xlsx
Create a new field, Command (String) – This is the field you want to build your command.
Expression:
'Rename '+ '"'+[FullPath]+ '"'+ ' ' + + '"'+[New File Name]+ '"'
Sample Output - Rename "C:\Users\johndoe\Documents\Sample Data\Command Line Test\$200.xlsx" "$200 2016-03-03 13-23-53.xlsx"
Create a new field, Batch File (String) – You will take the Directory field from the Directory Input and add a name of what you want the Batch File to be.
Expression:
[Directory]+'rename_files.bat'
Sample Output - C:\Users\JDoe\Documents\Sample Data\Command Line Test\rename_files.bat
Summarize Tool (4)–
Select the Command field and the action will be to concatenate using a separator as \n.
Select the Batch file and the action will be First.
You can rename the Output fields if you choose as it will change the fields to Concat_Command and First Batch File.
Output Tool (5) –
Browse to save file as any name you want (you will be replacing this name). You will want to use the Save as type: (.csv) and add .bat to end of the name. We want to transform that txt file to a bat file.
In the Delimiters Row in the Options section add \0 as the delimiter.
Select Take/Table Name From Field and choose Change Entire File Path.
Select the First_Batch file (or name you called the field) in the Field Containing File Name or Part of File Name and unselect Keep Field in Output.
Adding Batch File to Your Workflow:
The last step is to add this batch file to the Events tab in a Workflow that you want to move the file or files you have chosen in the .bat file in the Configuration window:
Select Add > Run Command> Run Event When> After Run>
Command: Browse to the bat file and click Ok.
This is the second article in the series of using batch files to rename, move, and delete files. This workflow will create a .bat file which you can use in workflows that use the files you specify in this workflow to move to another directory.
Moving Files
Creating the Batch file workflows:
Tools needed in order of use: (1)Directory Input, (2)Select, (3)Formula, (4)Summarize, (5)Output Tools.
Directory Tool (1) –
Browse to the file or files you are looking to change
Select Tool (2)–
Fields you will need are Fullpath, Directory, and File Name
Formula Tool (3)– Output Fields Created: Command and Batch File.
Create a new field, Command (String) – This is the field you want to build your command.
Note -The directory that you want to move the files to can be hard coded by adding the directory straight into the function or you can append another directory from another Directory tool before adding to the Formula Tool. In the sample, we hard coded the directory
Expression:
'Move '+ '"'+[FullPath]+ '"'+ ' ' + + '"'+ 'C:\Users\jdoe\Documents\Sample Data\Command Line Move'+ '"'
Sample Output - Move "C:\Users\jdoe\Documents\Sample Data\Command Line Test\$200.xlsx" "C:\Users\jdoe\Documents\Sample Data\Command Line Move"
Create a new field, Batch File (String) – You will take the Directory field from the Directory Input and add a name of what you want the Batch File to be.
Expression:
[Directory]+'Moving_files.bat'
Sample Output - C:\Users\JDoe\Documents\Sample Data\Command Line Test\Moving_files.bat
Summarize Tool (4) –
Select the Command field and the action will be to concatenate using a separator as \n.
select the Batch file and the action will be First.
You can rename the Output fields if you choose as it will change the fields to Concat_Command and First Batch File.
Output Tool (5) –
Browse to save file as any name you want (you will be replacing this name). You will want to use the Save as type: (.csv) and add .bat to end of the name. We want to transform that txt file to a bat file.
In the Delimiters Row in the Options section add \0 as the delimiter.
Select Take/Table Name From Field and choose Change Entire File Path.
Select the First_Batch file (or name you called the field) in the Field Containing File Name or Part of File Name and unselect Keep Field in Output.
Adding Batch File to Your Workflow:
The last step is to add this batch file to the Events tab in a Workflow that you want to move the file or files you have chosen in the .bat file in the Configuration window:
Select Add > Run Command> Run Event When> After Run>
Command: Browse to the bat file and click Ok.
See attached Sample Workflow.
This is the third article in the series of renaming, moving, and deleting files using a batch file. This workflow will create a .bat file which you can use in other workflows that use the files you specify in this workflow to delete files.
WARNING: Please be careful using this command as it will do what it says it will do. Test thoroughly before adding to production.
Deleting Files
Creating the Batch file workflows:
Tools needed: (1)Directory Input, (2)Select, (3)Formula, (4)Summarize, (5)Output Tools.
Directory Tool (1) –
Browse to the file or files you are looking to change
Select Tool (2) –
Fields you will need are Fullpath, Directory, and File Name
Formula Tool (3) – Output Fields Created: Command and Batch File.
Create a new field, Command (String) – This is the field you want to build your command.
Expression:
'DEL '+ '"'+[FullPath]+ '"'+ ' ' + + '"'+[FileName]+ '"'
Sample Output - DEL "C:\Users\dmenke\Documents\Sample Data\Command Line Test\$200.xlsx" "$200.xlsx"
Create a new field, Batch File (String) – You will take the Directory field from the Directory Input and add a name of what you want the Batch File to be.
Expression:
[Directory]+’Delete_files.bat'
Sample Output - C:\Users\JDoe\Documents\Sample Data\Command Line Test\rename_files.bat
Summarize Tool –
Select the Command field and the action will be to concatenate using a separator as \n.
Select the Batch file and the action will be First.
You can rename the Output fields if you choose as it will change the fields to Concat_Command and First Batch File.
Output Tool (5) –
Browse to save file as any name you want (you will be replacing this name). You will want to use the Save as type: (.csv) and add .bat to end of the name. We want to transform that txt file to a bat file.
In the Delimiters Row in the Options section add \0 as the delimiter.
Select Take/Table Name From Field and choose Change Entire File Path.
Select the First_Batch file (or name you called the field) in the Field Containing File Name or Part of File Name and unselect Keep Field in Output.
Adding Batch File to Your Workflow:
The last step is to add this batch file to the Events tab in a Workflow that you want to move the file or files you have chosen in the .bat file in the Configuration window.
Select Add > Run Command> Run Event When> After Run>
Command: Browse to the bat file and click Ok.
See attached Sample Workflow.
As currently designed, the Amazon S3 Download tool only allows one file, or object, to be read in at a time. This article explains how to create a workflow and batch macro that will read in the list of objects in a bucket and allow you to filter for the file(s) you want using wildcards!
If you haven’t used the Run Command Tool just yet, that’s great. It means that whatever your analyses required, we had it covered with basic Designer functionality. But in spite of how great the Designer is, it just can’t do everything. There is a utility on your computer that can do just about anything, however, and it’s the command line. The Run Command Tool pairs the two into a dynamic tag-team duo that can wrestle all the computation you could need into one, integrated, Designer workflow: