Alteryx Designer Desktop Discussions

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

Workflow stopped post an error on dynamic input, file was open by someone

Mahabirpanigrahi
8 - Asteroid

Dear Experts, 

 

Need a quick help! 

 

I have a workflow which pull data [ thru dynamic input] from 40 different excel files from a shared drive [NAS location].  It was running fine.

Today I noticed, workflow stopped as one country file was being opened by someone while workflow was running. I had this problem [file was opened] in past, that time workflow ignores that country file but flow executes successfully by bringing data from 39 other country files.

But today it stopped once the alteryx flow reaches that perticular country file. Not sure why?

Any suggestion how to improvise this?

 

My plan is to run the flow, if a country file has error [if file was opened or due to any other reason], ignore that file but execute the flow with rest.

 

Here is the image of the detail flow and error. Looking forward the help from the community.

 

Thanks

Mahabir

 

Picture1.png

8 REPLIES 8
WilliamR
Alteryx
Alteryx

Hello @Mahabirpanigrahi ,

one solution could be to do a copy of your data prior to the workflow execution (using the RunCommand tool) and to delete those files after. Even one file is open and locked, it seems that Windows allow the copy.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Mahabirpanigrahi
8 - Asteroid

Thank you @WilliamR  for reply. Is that only sollution ?

 

My data is really heavy, coping to different location will impact my performance. So just thinking there must be some other sollution.

 

Thanks

Mahabir.

j_acon
9 - Comet

Create a batch macro to read the input files one by one.

 

WilliamR
Alteryx
Alteryx

You could use a windows command script with the Run Command tool to detect if a file is locked or not, output the list and load those files with the dynamic input. I have tested a batch macro but, for me, the macro output the error.

You will find a good starting point for the command script here: https://www.dostips.com/forum/viewtopic.php?t=5542

If you are a python expert, you can also use the python tool to check, easy to implement than the command script.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

sraynal
7 - Meteor

Hello, 

 

I may have what you need. I made a "community" version in attached file.

 

Parse_Logs_Vtom.yxmd

1 - Get list file from a directory and create a file list "filelist.csv".

2 - Call the macro macro_locked_file.yxmc.

3 - Filter all locked files.

4 - You can add dynamic input after the filter.

steraynal_0-1576228800286.png

 

macro_locked_file.yxmc

1 - Parameters : 

filelist : The file list.

result file : Result output file

2 - Call the powershell script checkLockedFile.ps1 which check if a file is locked or not.

steraynal_1-1576229192590.png

 

You can test it by opening a log file in ./logs with MS Word.

 

 😉 

 

 

 

 

 

 

 

Mahabirpanigrahi
8 - Asteroid

Thank you @sraynal  & @WilliamR@j_acon  for your help! 

JokeFun
8 - Asteroid

Hi @sraynal ,

 

This is so far the best solution I have seen in the community. In the past a few days, I have been getting troubled with Run Command to check file lock status. I used a different approach, also referenced from another thread in the community, like

"@echo off"+"
"
+"2>nul ("+"
"
+" >>"+'"'+[File]+'"'+" echo off"+"
"
+") && (echo File is not locked.>FileStatusCheck.txt) || (echo File is locked!>FileStatusCheck.txt) "

 

This works as a single process. However, it failed when I added the macro to the application I built and could not figure out the root cause. It always says: 

Error: FileStatusCheck (1001): Record #1: Tool #2: The external program ".\FileStatusCheck.bat" returned an error code: 1

 

Now it's working by using your design. This is really great. Please accept my sincere appreciation!

 

PS. I just have no idea of the language in the PS1 file. 😄

rakamine
5 - Atom

This solution saved me.

Many other approaches I tried did not work, and also this solution works even if the files are in a folder I have no grant access to edit files.

Awesome!
Thanks a lot!

Labels