Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Writing data to a Location which is created as part of the Process

Timur_O
8 - Asteroid

Hi all,

 

I'm trying to create a macro which outputs to a location that is created as part of the macro, just in case it does not already exist. The problem is, I have to run it twice as the output tool does not recognise the location on the first run (as it does not yet exist when I hit run). The location (file path) is created one step before the output tool.

 

I've tried using the Block until Done tool but this does not have the desired effect. Is there any way you can think of that would allow me to make this work in one run?

 

Thanks,

 

Timur_O

12 REPLIES 12
JohnJPS
15 - Aurora

I'm surprised the Block Until Done doesn't work, as what you've described is the perfect example usage for the tool.

 

Also, you can use a Dynamic Input tool to open a file with a filename created within your workflow.  Perhaps that's what's missing for you?

Timur_O
8 - Asteroid

I thought that too...

 

The Dynamic Input sounds useful but I'm trying to output..!

RodL
Alteryx Alumni (Retired)

Keep in mind that the Block Until Done tool is designed to "hold" records at the point where the Block Until Done tool is inserted in the workflow until all records have been received upstream from the preceding workflow steps, so it wouldn't be expected to do anything related to the output (or creating a new location for the output).

 

And it sounds like it's really the directory that is needing to be created (i.e. the folder where you want the output is non-existent)?

 

You might try a Run Command tool that creates the specific folder with DOS commands, or I have seen where a workflow can dynamically build out and save a batch file with a MOVE command in it. You can save your output to a temp location and then this batch file can then executed as an event after the successful completion of the workflow. 

 

 

JohnJPS
15 - Aurora

The Output tool does allow you to populate the filename with a variable; look at the bottom portion of the config panel:

Capture.JPG

Timur_O
8 - Asteroid

Yeah, it is the directory which does not exist until after the preceding tool.

Timur_O
8 - Asteroid

Hmmm that may work if I create a text input containing the output file directory and name.

RodL
Alteryx Alumni (Retired)

Yeah, so Alteryx will not create the directory within the Output tool if it does not exist. You will need to do something like I suggested to do it dynamically within the workstream.

Timur_O
8 - Asteroid

I used the Append Fields tool to add the file location (including file name) to each record and used your suggestion to replace the entire file path and unchecked "Keep Field in Output". Using this meant that it needed to wait for the processing to finish so the file location exists by the point that it takes the file location from the input fields.

Timur_O
8 - Asteroid

Yeah, it would be great if they added the option to create the directory in the output tools.

Labels