Alteryx Designer Desktop Discussions

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

Working with files (rename, chance file extension, change location)

mathias_schnoor
11 - Bolide

Hey!

I have a given url in Input Tool and connect the Input tool with a Download Tool.

 

I configure the Download Tool to Output to a File >> Temporary File

 

 

 

ConfigureDownloadTool.PNG

 

As responce a get a Browse Tool a string with a file path

C:\..\AppData\Local\Temp\mytmporaryfile.tmp

 

Can I copy the Tempory File Path to a new location following my election and change his file extension.

 

I want to change the .tmp to a .png extension to display the png file on an Alteryx Workflow!

I that possible in Alterxy?

How?

 

Mathiias

 

20 REPLIES 20
KaneG
Alteryx Alumni (Retired)

Hi Mathias,

 

Your best option here would be to output to an actual file rather than the temp file. The temp file is not meant to be reused... When you select the output file, you can still have that in a temp directory by referencing %temp% as your path, that way it is still in a temp file that can be cleaned up by your computer, but is able to be referenced for now.

 

Kane

mathias_schnoor
11 - Bolide

Hey Kane!

Thank you for your support

I am looking for a solution together with Alteryx:

 

Is there exists an Alteryx-Tool that is made possible using and working with the temp-file:

1. Copy the temp file from the temp-file directory to a new location following my election. Such as C:\..\AppData\Local\Temp\mytmporaryfile.tmp => C:\alterxy\mytmporaryfile.tmp

2. Rename the temp-file and change the file extension. Such as C:\alterxy\mytmporaryfile.tmp => C:\alterxy\mypicture.png

3. Display the "new"-file with another Alteryx-Tool.

 

Or is there an other solution?

 

Mathias

 

 

 

 

KaneG
Alteryx Alumni (Retired)

Hi Mathias,

 

You can create a batch file and run that using the Run Command tool to move and rename the temporary file. The tricky part will be getting the right directory for the temporary file, hence why I suggested saving it to an actual file. 

 

The Batch file would simply be something like:

 

xcopy "C:\..\AppData\Local\Temp\mytmporaryfile.tmp" "C:\alterxy\mytmporaryfile.tmp"

ren "C:\alterxy\mytmporaryfile.tmp" "C:\alterxy\mypicture.png"

 

The way that I understand your workflow is:

  1. You want to use the download tool to save an image from the web.
  2. You then want to be able to select one of these images and have that appear in another workflow (I'm imagining as the background of a comments box or as the image in a report). And for this you have to copy the image to a specified location that the comment or image tool looks at.

The issues with this arise from, how are you going to select that you want that file copied? I take it that it is in another workflow. And if so then you may have trouble finding that temp directory to get the image from. 

 

Kane 

mathias_schnoor
11 - Bolide

Hi Kane!

 

Thank you for your support. I have create a batchfile to execute withhin the Run Comman Tool.

runCommandTool.PNG

 

But I do not understand what for an Input Connection and Output-Connetion is nessasary. I try this:

runComandToolException.PNG

 

Because when I run the workflow I get an excepition:

Run Command (1)    Either an Output connection or Input connection is required.

The Select-Tool selcted the DownloadTempFile.

Who is my bug?

 

Mathias

KaneG
Alteryx Alumni (Retired)

Hi Mathias,

 

If you don't care about what is coming into or out of the Run Command tool, then firstly, no need to connect it... if you want it to run in process though, then it will work essentially like this...

  1. The string that is coming in to the tool will be written to the file listed under "Write Source"
  2. Whatever is listed under "Run External Program" will be executed by this tool
  3. The file listed under "Read Results" will continue on the flow that exits the Run Command tool

 

So, if you don't want anything to continue after the Run Command, then don't put anything in the "Read Results" and don't connect any tool after the Run Command. If you don't need any data flow coming into the Run Command tool, then don't put anything in to the "Write Source" and don't connect anything to the start of the Run Command Tool.

 

I have attached a module that downloads some pictures, saves them somewhere and then moves 3 of the 5 images so that you can see how it works. In this module the batch file is created by the data stream that is coming in so that way it is dynamic.

 

Kane

mathias_schnoor
11 - Bolide

Hi Kane,

 

I understood the example, thank a lot.

I have change it to my needs, so I need an external batchfile any more.

 

Mathias

anthony
11 - Bolide

Best explaination I have seen on this tool.

 

Thanks.

Vizblend
6 - Meteoroid
Hi Kane,

I am receiving the same 'either an output connection or input connection is required'.

My batch file is standalone and is configured with neither a input/output. As all the necessary code is self contained, I have attempted configuring the batch file for just Command under the Run External Program.

I downloaded your example, but the solution provided had data streaming into it. Is it possible to run a process with only the Run Command tool?

Thanks in advance.
KaneG
Alteryx Alumni (Retired)
Hi Vizblend,

I'm rather sure you need either an input or output, but that is easily gotten around. Simply connect something to the input, and then send that to %temp%\e.1 using the write source option. If you are not using that data then make sure it is not a lot of data...
Labels