Alteryx Designer Desktop Discussions

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

Do while loop

Coopernicus
5 - Atom

Hi, 

 

I am building a workflow to refresh Tableau data sources. I already have a python script which logs into the Tableau rest API and starts the refreshes and I can easily add this to any workflow. The part of the flow I'm having trouble with is this... Is there a way to create a flow that can keep looping round until the current time has gone past a list of times in an input file?  In the example below, I need the flow to loop round, checking the list of refresh times against the current time, and only completing once the current time has gone past the last one listed. I think an iterative macro is needed, but not I'm not sure

 

Many thanks

6 REPLIES 6
caltang
17 - Castor
17 - Castor

Yes you will need an iterative macro to do loops in Alteryx. But in your case, you are saying - run the workflow and loop once a certain time has been exceeded?

 

Dashboard Datasource Time
A A 11:30:00
B B

11:45:00

C C 12:00:00

 

For instance, if in the workflow's time is 11:30, it will run only job A - whilst B & C will be lagging the workflow run time until 11:45, which means job B is then processed, and lastly... when it hits 12:00, it will run job C thereby completing the whole process?

 

I'm not sure if you have the Alteryx Server or not, but if you can schedule run them based on the above, you don't need an iterative macro.

 

Otherwise it's quite complex to do... the iterative macro will basically function like the Throttle tool on steroids...

 

How would you do it outside of Alteryx? Like with coding etc?

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Coopernicus
5 - Atom

Yeah, I have the Alteryx server, it could probably be done that way, but there are a lot of dashboards, with a lot of data sources. I was wondering if a workflow could be built which looped round and only started a refresh at a specific time, and only completed once all the refreshes have been started. 

Coopernicus
5 - Atom

If it can't be done or if it would not be practical I could put it all in a very long python script

caltang
17 - Castor
17 - Castor

I think it will be better to integrate your Python script via the Python tool to do this. Otherwise you could wait for others in the community to chip in ideas. From my POV, it's either done via Server or through Python as you mentioned. Not the most efficiet to throttle your data and execute in that order... not sure if Designer could even do that with an iterative macro.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Coopernicus
5 - Atom

Is there way to reference incoming data in the python tool? So if an input had a single row with a column that had either a 0 or a 1, I would want my python script to do a bunch of things if that column = 1, but pass if it's 0.

danilang
19 - Altair
19 - Altair

Hello @Coopernicus 

 

You can read attached inputs in your python tool by using 

df=Alteryx.read("#1")

This returns a dataframe representing the data connected as Input [#1].  You can connect multiple inputs to a python tool, in which case you'd use #2, #3, as required.

 

As for your server question, it's not a good idea to have a single workflow running and waiting for input.  Alteryx servers have a maximum number of concurrent workflow that can run, based on your license.  This starts at 2 concurrent workflows for the base license.  Having a workflow sitting and waiting for an elapsed time, will slow down all the other workflows scheduled on that server.  A better approach is to schedule a series of jobs during the period in question and have a flag that determines if they should refresh your source. 

 

Dan  

Labels