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.

Difficulty acquiring the FileName variable from InputData node with no records

PaulFields2
8 - Asteroid

I have a workflow that intakes .csv files then processes and uploads the results to my DB.  It renames the input files to avoid processing them repeatedly. The issue is that if there are no records (other than the header row) in one of the files, the InputData node does not populate the standard FileName variable.  Without this value I'm not able to do the rename, and in most cases my workflow throws the slightly cryptic error "Failed to run external program "%temp%\FileRename.bat": %1 is not a valid Win32 application. (193)"

 

I have successfully added Count node and a Message node to post a message in this scenario. The problem here is that my workflow is set up to process multiple files, and the potential for throwing an error can adversely affect processing the other files' data. The real solution seems to be to make the FileName variable available from the InputData node whether or not the file has records.  That way I can just rename the no-records file and be done with it.

 

Attached is my workflow and test files.

 

Steps to Replicate:

  1. Save the two .csv files to your Downloads directory in windows.
  2. Open the workflow, and in the InputData node replace the string {your user id} in the Connect to. . . . configuration field with your actual user name.

  3. Run the workflow. When it finishes go back to Downloads and you'll see the one named GOOD.MyTestFile_NEW.csv is now changed to GOOD.MyTestFile_PROCESSED.csv.  The file named EMPTY.MyTestFile_NEW.csv is unchanged.

  4. Run the workflow again, and this time it will error out because the file EMPTY.MyTestFile_NEW.csv has no records, and therefore the FileName variable cannot be acquired by the workflow, which will ultimately throw the Win32 system error.

Thanks in advance for your help!

 

4 REPLIES 4
Luke_C
17 - Castor
17 - Castor

@PaulFields2 

 

Maybe incorporating the directory tool can help? See attached, this gets both files renamed. I'm not sure if it would work in the larger workflow, but maybe this helps. 

fmvizcaino
17 - Castor
17 - Castor

Hi @PaulFields2 ,

 

You can use the directory tool to accomplish what you want.

Regarding the upload to your DB, you can use a dynamic input tool to read the files.

 

fmvizcaino_0-1616533731080.png

 

The block until done tool is being used to order your process. Read and upload to your DB first and then rename your file.

 

Best,

Fernando Vizcaino

PaulFields2
8 - Asteroid

Thanks - would you mind including the workflow you've modified?

PaulFields2
8 - Asteroid

Thanks!

Labels
Top Solution Authors