Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here

Is there a way to check if a file is in use and have the workflow wait?

Highlighted
10 - Fireball

Hi,

 

We've got some workflows that leverage shared yxdb resources as inputs.  Sometimes a workflow runs when one of those yxdb files is being updated / written to, and so the workflow returns an error saying that that particular input tool was unable to be opened and so that data wasn't read in.

 

It'd be ideal if there was a way to either have the workflow wait until the yxdb was available (they tend to get written to fairly quickly...no longer than 5 minutes) or to wait X minutes before deciding to throw an error for that input tool.  This thread suggests that this isn't built-in functionality (yet), and so I was wondering if there were any good workarounds to this.

 

Thanks in advance.

Highlighted
Alteryx
Alteryx

The path I would try is to create an iterative macro that does a File Lock check.  This would be a macro that calls a .bat file to do the check if file is in use, with a return of True or False.  The True stream would then use the Wait a Second macro from the Crew and iterate to run again.  If it is not locked, then use a Dynamic Input to load.  

Check this site for an example of the .bat code you could use.

Scott Jones
Strategic Sales Engineer
Alteryx, Inc.
Highlighted
10 - Fireball

Hi Scott,

 

Thank you...that helped set me on the right path.  I've never written batch scripts before, so that part wasn't initially clear, but after some Googling I figured it out. :-)

 

I'm attaching my workflow in case you want to check it out and suggest any ways to improve it.

 

file lock check.png

Labels