Select Page

In the final instalment of this macro series, we will be diving into field of iterative macros. We will start off by defining what these macros are and look at what they can do. Following this we will be jumping straight into an example. So, let’s kick it off!

##### What are they?

An iterative macro allows the user to set a condition and will repeatedly run each record in loop; back through the workflow until that condition is met. This is particularly useful when you’re working with a large workflow and would like to give the users options for interactivity. Or even ask the what if questions. What if interest increases by 10%? What if we extend this to 5 years instead of 3, what will the result look like. Rather than recreating that workflow over again, we adjust the iteration conditions instead.

##### Let’s jump into an example

Continuing our shelter example, say we want to calculate how much growth in income/ investment we require to improve our facilities based on our 4-year business plan. So, say we wanted to reach \$40 000 within 4 years to be able to install a new play area for our animals. How can we calculate how much growth we require? And more importantly, is it feasible with our 4-year plan. Currently our income is \$10 000. We anticipate our growth rate to be 0.4%. Can we achieve this?

###### Step 1:

First, we start off by creating our input, start off with a text input and enter any value. Here I use  \$10 000. Then we want to configure our canvas settings so that it will process our iterative macro. Click on the white space on the canvas and go onto workflow, as seen below.

###### Step 2:

Next, we want to set up our workflow with placeholders, note which values you would like your users to be able to change with the interface tools. We will be changing these in the next steps. But first ensure you have an iteration setting, so here we are iterating the year value. So that the years will continue to run through this macro until our conditions in our filter and formula tool have been met. We can do this by setting the Engine iteration to year, note that this number starts at 0. So, to start at year 1, we need to add 1.

###### Step 3:

Add your interface tools, here we want the user to set the growth rate and the desired outcome to get the year in which these conditions are met. Ensure you adjust the update value tools so that the user can make these changes. Then we must set our iteration input and output which you can find on your interface designer. To access this, go to the top tab, find view, and check interface designer. Set your output tools, for the purpose of this blog I will be demonstrating 3 output to show what these outputs can produce from our conditions.

###### Step 4:

Test it out, let’s try and answer our question. What result do we get?

No, it is not feasible save up \$40 000 at a growth rate of 40% for 4 years. We can see this shown in output 1 and output 3. So now we can adjust these values to meet our goals or set new strategies. The animals need a new play area ☹.

This concludes the macro series, I really hope this has helped you understand how and where we can use standard, batch, and iterative macros.

Missed an earlier instalment?

Find it here :

Alteryx Tip: What are Macros? And how are they useful to me? Part 1 of 3 – The Data School Australia

Alteryx Tip: How can I use Batch Macros? Part 2 of 3 – The Data School Australia