Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Need workflow on server to loop until source data file has been updated

dnomasur
7 - Meteor

Hi Alteryx Community,

 

I have a scheduled workflow that runs on the server each business day at 7:00AM, but only when the required source data on the LAN has been updated before that time.  When the source data is NOT available by 7:00AM the workflow is designed to shut down and email me to notify of the failed run.  So far it's working exactly the way I want it to, except that I then to manually re-launch the workflow later once the source data finally appears on the LAN. 

 

The obvious next step from here is to have the workflow keep looping (say every 30 minutes or so) whenever there's a failed run, and then finally halt for the day upon the first successful run.

 

My research so far seems to indicate that an Iterative Macro might be the solution I'm looking for here, but I haven't yet found any examples that are really similar to my situation.  More specifically, my current process uses a Directory tool to identify the source file's last modified date, but the Directory tool doesn't have an input anchor to which I could attach a Macro Input tool.  So how do I create a loop in my workflow when there's seemingly no way to get 'in front of' that initial Directory tool?

 

I hope this was clear, and I'd love to know how others may have worked through any similar situations.  Thanks in advance!  

3 REPLIES 3
jrgo
14 - Magnetar

The v3 API macro pack does include support for creating a schedule, but I believe you will need to do some research on how to prepare the request body it requires to create the schedule contract.

https://community.alteryx.com/t5/Engine-Works/Introducing-the-Alteryx-Server-v3-API/ba-p/899228

 

So, in theory, you can design a process that will route something to these tools to create a new "Run Once" schedule when your condition was not met.

 

Again, all theoretical and something I've never developed, but I can't think of a reason why it wouldn't work.

 

Either way, hope this helps!

fmvizcaino
17 - Castor
17 - Castor

Hi @dnomasur ,

 

While the iterative macro would be the most indicated solution for the loop, I wouldn`t advise it since it would continuously use one spot of the workflows you can run simultaneously and mess with your workflow queue. 

 

My suggestion:

  1. A workflow scheduled to run every 30 minutes all day long
  2. Workflow with 2 additional batch macros:
    1. Check a yxdb file with the last complete run. This file contains one row with the date the workflow ran completely. If the date is not today, go to the next step
    2. Batch macro - Check if the source file has been updated. If so, go to the next step, if not, send you an email
    3. Batch macro - Your process. At the end of the process, create the yxdb file with the updated date.

I`m including a workflow with the batch macros only with the concept. On all examples of batch macros, you usually see a connection between the control parameter and a tool. In our case, it is not needed because we are only using a batch macro to do a sequential process.

Another important note is that the batch macro will run the same amount of times as the number of rows entering the input. In our case, we only have one row with the date or the true/false input.

 

More on batch macros: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Knowledge-Base/Getting-Started-with-Batch-...

More about the worker queue: https://community.alteryx.com/t5/Alteryx-Server-Knowledge-Base/Alteryx-Server-System-Settings-Deep-D...

 

Best regards,

FErnando Vizcaino

dnomasur
7 - Meteor

Thanks to you both!  This gives me some ideas that I'll attempt to incorporate into my particular situation.