Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Specify JSON input file on command line

SeanReadFord
6 - Meteoroid

I have an Alteryx workflow that reads a JSON file (output from an API call) and puts it out to an Excel sheet.  This will be part of an automated nightly script, so I'm running AlteryxEngineCmd.exe in a DOS .bat file.  Is there a way to specify the input file in my "BLOB input from JSON file" tool on the command line? 

2 REPLIES 2
BenMoss
ACE Emeritus
ACE Emeritus

Hi @SeanReadFord, I think there may be an easier way to do this by telling your workflow to read the blob file in a dynamic fashion rather than doing this within the .bat file.

 

The below is the scenario I envisage, it may differ slightly to yours but hopefully you can take this and adjust it to your usecase.

 

In Alteryx the 'directory' tool allows us to read a list of files within a given directory. Lets say each night a new json file is created. We can ue the 'created date' to sort our list of files in order of which they have been created (descending would be the latest file first) and then use the sample tool to isolate just the single latest file (thus, this will change each time our workflow runs once a new file has been added to the directory).

 

The Fullpath field for that file can then be passed dynamically into either a dynamic input tool, or blob input tool (not sure why you are using this over a standard input tool), in order to read in your file.

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-to-dynamically-run-the-most-rec...

 

However, a much better way of doing this would be to use Alteryx to perform the API call, how are you doing this at the moment? You can then simply immediately parse the resulting JSON in Alteryx rather than write it to an intermediate file.

 

Ben

SeanReadFord
6 - Meteoroid

Thanks @BenMoss, I will look into this.  I've got it working now by (temporarily) renaming the input JSON file in my .BAT file to what Alteryx expects, ditto with the output file.  I have not yet explored the possibility of making the call via Alteryx, there are a bunch of calls with different parameters to gather the info I need, and between that & needing to modify the header of the call to specify authorization, it seemed easier to do it externally. 

Labels
Top Solution Authors