Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Creating a workflow which loops until condition is met

Austin09
6 - Meteoroid

Hi all,

Firstly wanted to say I'm loving using Alteryx so far! Secondly, wanted to apologise in advance for misnaming anything - I'll try my best to explain what I'm trying to do! 

 

Simplified aim: I'm trying to get to a data set of competitor restaurants which are within a given proximity of a particular brand. e.g. Find the set of restaurants near all the McDonald''s in the UK.

 

Now, to get the data I want it so that I limit the share of restaurants in the competitor set, so one brand doesn't exceed 50% e.g. if there are 5 fast food restaurants in the comp set, and 3 are Burger King, then I'd want to adjust the data. 

 

So far I've tried this manually, and it works, however, as I'm a massive data geek, I want to know if I can create a loop which can do this, without me creating multiple sets.

 

I have the data ranked by proximity at the moment, so I'm only picking the nearest 7 restaurants to a given McDonald's. Then I have tested if any brand accounts for over 50% of the competitor set. My manual flow says... if it has more than 50% of one brand, add the next nearest restaurant than isn't the brand that has the highest share of compset i.e. if there are 60% Burger King in the set, add the nearest brand that isn't Burger King. I've done this latter part manually, but repeating the flow a few times i.e. at the 7th closest restaurnt... test... add the 8th.... test.

 

Is there a better way to do this which says..... Test if comp set >50%, if so add the next closest until that condition is met. Is there a tool in the palette I've overlooked, I suspect I've overcomplicated this! Some of the similar posts in here talk of macros, but their problems are more complex than mine.

 

Thanks in advance to anyone that can help!

12 REPLIES 12
Austin09
6 - Meteoroid

Thanks again!! I've been playing with the macro this afternoon, using the steps you suggested - I'll simplify my data input and steps just so I can get this working right. 

 

Once I get a workflow that looks ok I'll try send you a PM with the workflow - if I still can't do that I'll create a mockup of some dummy data.

 

tcroberts
12 - Quasar

Hey Austin,

 

I saw your post with an e-mail but I was away all weekend and I guess it got auto-edited. This sounds good to me though.

 

I looked it up and apparently you should have access to PMs since you're Atom Rank, and it only requires Matter Rank. See details here.

snigdhacjha
7 - Meteor

Hi @Austin09 @tcroberts,

 

I have been looking for content to understand how to implement iterative macro for my project and this thread has so far been the most helpful.

Although I am still confused on a lot of conceptual things and how to use them using an iterative macro.

 

Use Case - Want to fetch data from an API for last 2 months. The format of API Contains from_date and to_date.In each run I only want to fetch 1 day worth of data. My basic workflow should be 
<condition for iteration>- <check if the condition is true> - Run the workflow with new date - <Repeat until condition for iteration is not met>.
All I have done until now is create an iterative macro that adds 1 day to last date in the table present in my database.

 

How do i set the iteration condition and end condition for the workflow ?

 

Labels