Alteryx Designer Desktop Discussions

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

Run a .bat file based on user input

SriKoka
7 - Meteor

Hello,

 

I want to run a .bat file using Run command to delete a file. I have a list box with two inputs: File 1 and File 2. If user selects File 1, then the .bat file needs to delete File 1. If user selects File 2, then .bat file needs to delete File 2. If user selects both files, then both files need to be deleted. If user selects nothing, then no files are deleted. How do I dynamically delete files based on user selection? Much appreciate your help.

 

Thanks,
Sri. 

5 REPLIES 5
Qiu
20 - Arcturus
20 - Arcturus

@SriKoka 

Create something for you. Please adjust the path as per your condition.

0205-SriKoka.PNG

SriKoka
7 - Meteor

@Qiu 

Thank you for this solution. It works beautifully when user selects a file from the list box for deletion.

 

In some instances, no file deletion is necessary. So user doesn't select anything on the list box. When this happens, I am getting an error message. How would I handle such scenarios?

 

SriKoka_0-1612506576372.png

 

Qiu
20 - Arcturus
20 - Arcturus

@SriKoka 

WIth some dummy data

0205-SriKoka-1.PNG

SriKoka
7 - Meteor

@Qiu 

 

This is super helpful. I was getting a different error message when no files were selected (see error message below). I realized it was running an empty bat file and hence throwing this error. I wrote a dummy command line "exit" to circumvent this issue. And it worked! Thank you very much... 

 

 

Qiu
20 - Arcturus
20 - Arcturus

@SriKoka 

Thank you for the accept mark. and nicely done!

Labels