Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

How to flatten records / loop over records

Verakso
11 - Bolide

I have been struggling with a "simple" task, but I simply cannot get my head around it, on how to solve this using Alteryx.

 

What I am trying to do, is kind of a flattening a kind of hierarchy, by which there is many examples of here, but this is bit simpler.

 

I have a set of data with travels, start point and end point, like this, but in no particular order


2018-08-28 23_49_24-Alteryx Designer x64 - travels.yxmd.png

 

 

 

 

 

 

 

 

What I am trying to accomplish is something like this

 

2018-08-28 23_49_55-Alteryx Designer x64 - travels.yxmd.png

 

 

 

 

 

 

 

 

 

 

I have tried different approaches, joining on end point to start point,  and also the Multi-Row formula, but so far I have not crack this nut, and would like to know how to do such a recursive lookup to do this.

 

Br
/Verakso

4 REPLIES 4
Inactive User
Not applicable

Answer attached. Used an iterative macro to do this.

Verakso
11 - Bolide

Hi Ryan

 

I have accepted you solution since it does work, but my head is still spinning,

 

So I have learned something new, iterative macros. I had to read up on that and see a few training videos, but I do not think I have completely understood how it is solved anyway.

 

So the first part I seem to get2018-08-29 21_29_27-toast.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

It is the macro I am trying to get a grasp at2018-08-29 21_31_47-toast.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I kind a get the two text inputs, the join and the formula, but then I am lost.

What is the I Output doing, and how does the iteration actual work?

 

When I have looked at other examples, there seems to be some kind of loop in either the macro, or in the workflow surrounding the macro.
Kind of what I would have expected with the outcome of I Output macro output.

 

So yes it works, but I have not quite figures out why.

 

//Verakso

 

 

Inactive User
Not applicable

The I output in the macro is the next iteration. The I output will go to the I input and start all over again until there are no more iterations. The Join takes the iteration record and joins to the main dataset From/To. It will run out of iterations once there are no other trips/joins. 

Verakso
11 - Bolide

Hi Ryan

 

I appreciate you time to reply. I was in the meantime taking a deeper look my self, trying to get a grasp of how this works.
So I watched a couple of more videos on the subject (slow speed), and I finally had the Eureka moment.

The magic between the I Input and the O Output2018-08-31 10_35_53-toast.png

 

I done in the Interface Designer - Properties2018-08-31 10_36_48-Interface Designer - Properties.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Here the iteration logic, or the loop as I mentioned is configured.

So I get it now.

 

On a personal note, when I was trying to built up my own macro from scratch I had put it a rather high number in the max iterations number, which had me wait quite a while until I realized I had make a mistake in the macro ;)

 

But thanks again for your time, to help me to understand this.

 

Br
/Verakso

 

Labels