Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Workflow to load files - how to handle the problem of no files to load

cmcclellan
13 - Pulsar

I want to process one file in a folder, so I do this:

 

 
 

2024-05-22 08_26_22-192.168.88.18 - Remote Desktop Connection.png

 

 But I also want to NICELY stop the workflow if there's no files to process.  At the moment I'm using a Count Records > Filter > Message (as an error), but is there a "nicer" way to stop the workflow when there's no files to process (ie without generating an error) ??

8 REPLIES 8
caltang
17 - Castor
17 - Castor

Hello @cmcclellan ! You can consider this: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Detour-when-no-records-are-pre...

 

Worked for my use case, similar to yours.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
cmcclellan
13 - Pulsar

Hi @caltang 

 

Which bit worked though? I'd already written a workflow similar .... use a Count Records and a filter ... but there's no records to count, so there isn't a value to filter on.

 

I guess I don't understand how a Detour would work here, because it's a selective detour based on the presence of records ... or not.

caltang
17 - Castor
17 - Castor

Something like this?

 

Let me clarify, are you looking to stop the workflow immediately at the input stage if there's no file?

 

image.png

 

EDIT: I just realized I pasted the wrong link, this is the one: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/How-to-by-pass-part-of-workflo... - my bad!

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
caltang
17 - Castor
17 - Castor

Okay I re-read your statement and you're looking to stop it without an error... usually cancelling it WITH error is the way to go to my understanding. Re: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Sequenced-Containers-Macro-how... 

 

But I'm interested to know how to stop it without error as well now.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
cmcclellan
13 - Pulsar

That's it :) .... it's easy to stop the workflow with an error, but I want to stop the workflow without errors, but not process the majority of the workflow when there's no file to process.

It sounds simple, it's harder in reality.

LindonB
11 - Bolide

Hi @cmcclellan,

I'm assuming you're reading in the file with a Dynamic Input after getting the FullPath if a file exists? If so, here's a solution.

There are four steps:

  1. Add a filter to check for empty row. You need this because the true leads into what to do if no file is found, and false leads to what to do if a file is found.
  2. Add a test tool after true to replicate what was done in the filter - aka check for empty rows again.
  3. In Designer, go to the workflow configuration under the "Runtime" tab and check "Cancel Running Workflow on Error". (An error isn't actually generated, but the workflow does stop running, meaning that tools that would produce errors, such as with the Dynamic Input tool, will not run.)
  4. Build the rest of your workflow off of the Filter = False path. 

6.PNG

 

4.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

cmcclellan
13 - Pulsar

That still doesn't work .... I've attached my workflow to show what I'm doing.

 

I'm using this:

 

The folder structure is:

 

c:\testing

c:\testing\archive

 

The CSV file is in c:\testing

 

The first run of the workflow, everything is fine and the CSV file is moved to the archive folder

 

BUT on the second run (when there isn't a file in c:\testing) I'm trying to make the workflow run without an error at all, but also NOT run through the Dynamic Input tool

cmcclellan
13 - Pulsar

Hey @JoshuaB after our chat last week, I found the thread ... I just didn't realise I posted it in May :) 

 

Can you have a look and see if you can find a solution?

 

I hope you enjoyed your time in Australia :) 

Labels