âShow Table of Contents
Run Command Tool
The Run Command tool allows you to run external command programs within Alteryx. This tool can be used as an input, output, or an intermediary tool.
The Run Command tool cannot be used in apps saved to the Alteryx Analytics Gallery.
Using the Run Command tool is similar to running applications directly from the Windows command line, but with the convenience of remaining within the Alteryx GUI. For example, you can use the tool:
- when Alteryx does not have needed functionality.
- in conjunction with curl.exe to download data from web or FTP sites.
- to call third party applications.
- to wrap custom functionality written in other programming languages.
If the program you are using does not set error flags, you should wrap it in a batch file to make sure the output file is deleted before it is run.
Configure the tool
When you run the workflow, the Run Command tool configuration is executed in sequence: Write Source, Run External Program, and then Read Results.
- Optionally specify a Write Source output. The write source is data that comes into the tool as a file, SQL server connection, or any supported output type. Only specify a write source if you are using the Run Command tool as an output or intermediary tool.
- In the Run External Program section:
- Specify the external program Command to run. For example, this could be a program that acts on a write source and generates read results.
If the external program is a UNIX-style command line app that takes input from stdin and writes to stdout, you can use the << and >> operators to pipe the information to and from files. For more information, see the Microsoft documentation.
- Type the Command Arguments, if any. Most commands are used together with one or more arguments. Whether arguments are required or optional varies by command.
- Optionally specify a Working Directory. If you leave this field blank, the default is the directory where the workflow is saved.
- Select Run Minimized to minimize the Run Command window to the task bar when Alteryx executes the external command.
- Select Run Silent to not display the Run Command window when Alteryx executes the external command.
- Optionally specify a Read Results input. This file is carried through the rest of the workflow. Only specify a read results input if you are using the Run Command tool as an input or intermediary tool.
Example use case
In this example, the tool is configured as follows:
Write Source: (blank)
Command Arguments: http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=KCOBOULD10&month=6&day=19&year=2005&format=1 -o "%temp%\temp.csv"
Working Directory: (blank)
Read Results: %temp%\temp.csv
- The tool is configured as an input file in the Alteryx workflow. Therefore, Write Source is left blank.
- The Command is curl.exe, which is a free and open source program that allows you to download files from a web page. For more information, see the curl documentation.
- Command Arguments includes the complete path of the file to be downloaded, as well as an output command and the file to output (in this case, -o "%temp%\temp.csv", which means to output (-o) the content from the web page as a file called temp.csv.)
- Working Directory is left blank to default to the directory where the workflow is saved.
- Read Results refers to the temp.csv file to return from
the downloaded content and its relative path (%temp% references
the temporary directory). The curl program has already downloaded
the content and is handling the data as this .csv file. Alteryx is
reading the .csv file as if it came from an Input Data Tool. The file
can now be processed downstream.
Â©2017 Alteryx, Inc., all rights reserved. AllocateÂ®, AlteryxÂ®, GuzzlerÂ®, and SolocastÂ® are registered trademarks of Alteryx, Inc.