Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Run Command for Multiple Rows in CSV (Batch Macro?)

toby_jutras
6 - Meteoroid

Hellow Alteryx Folks!

 

I'm trying to automate a process using Alteryx, in which I want to run a program on the command line once for each row in a CSV, feeding the values from the CSVs as parameters to the command line.  I think I need to be using a Batch Macro with Run Command, but I am having trouble fully understanding either concept, and need some help.

  • Run Command seems to be pretty fussy about when input/output files are specified
  • Batch Macro examples seem to be pretty far off from what I'm trying to do, and I can't make the leap

As an example, let's assume I have a CSV as follows:

Number,Person,Attribute

1,Jim,Funny

2,Sally,Sad

3,Sam,Happy

 

I would like to use a Run Command that will Echo each concatenation to the CMD prompt.

  • Command: C:\Windows\SysWOW64\cmd.exe
  • Command Arguments: Echo 1 Jim Funny 

I'd like the completed solution to repeat the process for each item in the .CSV.

 

My actual application is to run TABCMD from within Alteryx to generate PDFs for push reporting.  I currently do this with PowerShell, but there is an awful lot of code that I think could be replaced with Alteryx... if I could just figure out how to combine Batch Macros and Run Command... or maybe there is a better solution?

 

Thanks,

Toby

 

 

3 REPLIES 3
MarqueeCrew
20 - Arcturus
20 - Arcturus

@toby_jutras,

 

I went about this in a different approach than specified.  I attempted to run the cmd command with an argument of "Echo 1 Mark Puzzled" and I got the command window to appear, but it didn't echo anything.  While that is possibly what you need (I can help you to run a command repeatedly in that manner), the desired result was satisfied by this module.

 

Capture.PNG

It takes your input file and constructs a script of echo commands in a batch file called, runme.bat.  At the end of the run I setup an event that will run the command:  runme.bat.

 

Each of your commands is scripted to execute.  I think that will help you.

 

By the way, when I execute a run command within a workflow, I generally setup a DUMMY.CSV file (contents = DUMMY) and use it as a READ source.

 

Thanks,


Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
toby_jutras
6 - Meteoroid

Mark,

That is a really cool approach... thanks for thinking about this.

 

While the resulting .bat will work for creating the PDFs using Tableau TABCMD, I was hoping to embellish the workflow with the reporting tools so it automatically sends each resulting PDF to the intended recipient.  I have that covered in my current PowerShell script, but I have to believe there is an easier way.

 

Thanks,

Toby

MarqueeCrew
20 - Arcturus
20 - Arcturus

If you create a FILENAME variable, you can OUTPUT the file and use the FILENAME variable as the actual filename.  You could have a list of all of the filenames and construct a batch script accordingly.  You're closer to an answer.

 

Thanks,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Labels