Alteryx Designer Desktop Discussions

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

Output to new folder

mikirkeby
5 - Atom

Hi,

 

I have an issue with some backups. I'm reading a bunch of tables from a datebase, appending a prefix with a date stamp, and saving them individually as .csv files. Since the flow with these backups is to be run weekly, I would like it to automatically create a new folder with the date as the file name, and output the individual .csv backup files inside this folder.

 

Is this possible?

18 REPLIES 18
JohnJPS
15 - Aurora

Hi @mikirkeby

You could use a Blocl Until Done tool and from the first output, create the folder (either with System Command, or the R tool); then from the 2nd output, write the CSV to that folder.

Hope that helps!

John

rpaugh
11 - Bolide

Something I do is use a formula field to dynamically build a path...

 

[File Name] = [FilePath] + [Source_FileName] + [FileNameExtension]

 

...where [FilePath] changes based on file and date, then set my output to take that full path...

 

Alteryx Dynamic Output Path.png

 

Is this the method you're currently using?

mikirkeby
5 - Atom

How can I automatically create the folder using system command? (I don't R tool in my package) 

SeanAdams
17 - Castor
17 - Castor
Great article here that you can refer to: https://community.alteryx.com/t5/tkb/articleprintpage/tkb-id/knowledgebase/article-id/571

Just to strip this down so that you can get experience with creating folders - let's do a quick canvas that only creates a folder
Tool 1: text input. Put 1 field in here, and in that you put the command "mkdir c:\temp\foldername". Note- this will fail if c:\temp doesn't exist so that may be step 1.
Tool 2: Run command:

- Set the write source to write to a temporary batch file. This file is created on the fly by the run command with teh command you provided in Tool 1

- Then execute this run command

- Finally - you need to specify a read location - just put any file in there (it uses that to pass on data to the outbound leg). You could re-read the batch file you've just created.

This works like a charm and is very reliable.
Let me know if I need to mock this up for you when I get home?

[cid:image001.png@01D2B919.1720EB40]

[cid:image002.png@01D2B919.3F3D7940]
mikirkeby
5 - Atom

A mock-up would be very nice, thanks!

 

 

SeanAdams
17 - Castor
17 - Castor

Here you go Michael,

 

Stripped this down to the bare bones to demonstrate the concept.  Note - this relies on you having a folder on your c:\ called Temp, but you should be able to amend as you need.

 

Thank you for following up with me - hopefully this solves your problem.

 

I would suspect that if you need to create some directories, then write a bunch of files, you'll need to wrap this in a macro.   If that's the case - shoot over some sample data, and we can take the next step of showing you how to do both the folder creation, and then also writing the data into the files in the subfolder.

 

Cheers

Sean

r4upadhye
11 - Bolide

Works Perfectly !!!

thanks @SeanAdams

DavidBaker84
6 - Meteoroid

Hi

 

I have used the Make Directory Batch to create my new folder structure and works great.  However I am having trouble ensuring my output dynamically selects this new folder when saving the output.

 

Any advice?

 

Regards

David

tazeen
5 - Atom

Hey, I tried running this and it gives me "The external program returned an error code 1"

Labels