Alteryx Designer Desktop Discussions

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

Continue workflow after input error

MartWClimber
9 - Comet

I'm building a workflow that should always continue if the error File used by other process occurs.

 

 

Error: Input Data (34): Error opening the file "[location/name]": The process cannot access the file because it is being used by another process. (32)

 

 

the file i'm accessing is a log file that if it is being written to (by other proces) the workflow i'm building should continue with default values if the log file is still in use by the other process.

I'm wondering if this is possible.

 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @MartWClimber 

 

Since it's an input file it is not possible for the workflow to proceed without the input data loaded in.

 

Hope this helps : )

 

 

MartWClimber
9 - Comet

@atcodedog05 yea, that was what i'm afraid of. Thanks for the quick response

 

 

Well that means I need to schedule this workflow right after the log workflow.

 

Seems a great job for the crew runner macro :) 

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @MartWClimber 

Cheers and have a nice day!

ChrisTX
16 - Nebula
16 - Nebula

Here's a somewhat related post: https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Input-Data-resume-on-error/m-p/839100#...

 

You could determine if the file is locked, then pass either the unlocked file or a default file to a Dynamic Input tool.  Attached is a sample workflow.

 

Here's some code from another language that writes out and runs a Powershell script, to check for a file lock:

"LIST UNFORMATTED" translates to "write to a text file"


com ************************************************************************************
com Determine if file is locked
com ************************************************************************************

 

LIST UNFORMATTED "try {" APPEND TO "%folder_name%powershell_script.ps1"
LIST UNFORMATTED " [IO.File]::OpenWrite($InputFolderAndFile).Close();" APPEND TO "%folder_name%powershell_script.ps1"
LIST UNFORMATTED " $host.SetShouldExit(100); # file is NOT locked by a process" APPEND TO "%folder_name%powershell_script.ps1"
LIST UNFORMATTED "}catch {" APPEND TO "%folder_name%powershell_script.ps1"
LIST UNFORMATTED " $host.SetShouldExit(101); # file IS locked by a process" APPEND TO "%folder_name%powershell_script.ps1"
LIST UNFORMATTED "};" APPEND TO "%folder_name%powershell_script.ps1"

 

com ************************************************************************************
com Run the Powershell script and set the output variable
com ************************************************************************************

 

EXECUTE "powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -WindowStyle Hidden ""& '%folder_name%powershell_script.ps1'"""

 

ASSIGN v_Return_Code = RETURN_CODE

 

ChrisTX_0-1644932201071.png

 

 

Chris

Labels
Top Solution Authors