Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Output to a shared drive, but if I cannot connect output to desktop

RMotiwalla
8 - Asteroid

Hello all!

 

I have a workflow that is set to be saved on a shared drive at work. It always works on site, but when working remotely if I lose my WiFi signal then I cannot save to that drive.

 

Is there some way to have it output (via render) to the shared drive, but if it cannot connect then it saves it to a location on my desktop? 

 

I realize i could have it output to both, but I would prefer to save it on my computer only if I have to.

 

Thanks!

Rob

8 REPLIES 8
bbak
9 - Comet

It sounds like you will have to use a cmd script to check whether or not the connection to the network drive is live as well as a detour tool that points to the local location if the network location is not available. 

bbak
9 - Comet

This is a simple batch script that checks to see if the M Drive is connected. You could swap this out with the name of your drive that you have connected. I don't have experience passing values from a command prompt back into Alteryx, but maybe someone else can chime in. 

 

 

 

@Echo off
title LAN Check
color 0b
cls

 

if not exist M:\ goto bad
if exist M:\ goto good

 

:bad

color 0c
title Disconnected
cls
echo ____________________
echo You are disconnected
echo ____________________
ping localhost -n 4 > null
exit

 

:good

color 0a
title Connected

cls
echo ____________________
echo You are connected
echo ____________________
ping localhost -n 3 > null
exit

RMotiwalla
8 - Asteroid

Hi Bbak,

 

Thank you for the start on this issue!

 

I got the command prompt to work so that it indicates if the connection is active, I am just not sure where to go from there.

 

I need some logic that says if the connection is active to save to shared drive output, otherwise save to desktop. But I really have no idea how to properly configure this tool, so any further suggestions would be greatly appreciated!

 

Thanks,

 

Rob

 

 

bbak
9 - Comet

I modified the script a little bit and added in either echo offline>connection.txt or echo online>connection.txt based on the result. That means that the script will write a text file with either "offline" or "online" in it depending on the outcome. Then in the run command tool in Alteryx, you specify to run the command in the Run External Program box. After that, you select the text file offline/online output in the Read Results box down at the bottom. That means that when the batch file is run and we get the output, the run command tool in Alteryx will have either "offline" or "online" coming out of it. My suggestion would then be to use a formula tool to do something like this:

 

 

IIF([Field_1]="offline","C:\Users\blahblahblah\desktop","M:\NetworkDrive") 

 

So basically you could use a simple true false statement to say if the output file says "offline" then use the desktop path, and if it says "online", use the network path. Then in your output tool, you can check the box to "Take File/Table Name From Field", Change Entire File Path, and then use the output we get from this command prompt. 

 

 

 

CMD Output.PNG

jwalder
10 - Fireball

You could output the file locally and then MOVE it to the shared drive. If you are unable to reach the shared drive then it will fail and you will still have the local copy. If it can reach the shared drive, then it will no longer be on the local drive when the MOVE completes. If you are looking for non-command ways to do file system activities, we built a tool for that called "File System Tool", see here: https://community.alteryx.com/t5/Alteryx-Knowledge-Base/Partner-Tools/ta-p/123297

 

Cheers!

steven-barsalou
8 - Asteroid

There are many ways to solve this problem.  As others have suggested, you can create a batch file and run it in the command tool or output to a local drive and try to move it to the network drive.  Those will certainly work, but I prefer to use 100% Alteryx solutions when possible.

 

You can use the FileExists() function in a formula tool to test if the network directory exists.  Something like "FileExists('\\network_drive\output_location')".  This will output a true or false (aka boolean).  You will use the boolean output of this formula as the input to a standard macro you'll create.  Inside that macro, you'll setup a detour based on the network directory existing or not.  

 

See the attached for a working example of this.

RMotiwalla
8 - Asteroid

Hey Jwalder,

 

I tried to download the tools and it did not work. I got the email sent to me and the installer, but when I enter my email and license key it says my information is not valid.

 

Is there some work around for this?

 

Thanks,

 

Rob 

RMotiwalla
8 - Asteroid

Thank you for the help on this!

 

I got with our Alteryx Customer representative and he was able to help me make this work for my case.

 

He also helped me turn it into a macro, so I will upload that in case anyone wants to give it a try.

 

Thanks!

 

Rob

Labels