Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Loop through Data without a Macro?

Rinearb
7 - Meteor

Is there a way to Loop through Data in Alteryx without a Macro? Or is the easiest way to use an iterative Macro?

 

Here is my predicament. I need a way to loop through a range and have each row repeat a certain number of times. An example range is below. The fields are Area, QuestionID, and Questions. I need the range to repeat let's say 3 times. How would I go about this?

 

AreaQuestion IDQuestions
structure1Who
structure2What
structure3Where
unstructured1When
unstructured2Why
unstructured3How
other1Comments 1
other2Comments 2
other3Comments 3

 

Outcome:

AreaQuestion IDQuestions
structure1Who
structure2What
structure3Where
unstructured1When
unstructured2Why
unstructured3How
other1Comments 1
other2Comments 2
other3

Comments 3

structure1Who
structure2What
structure3Where
unstructure1When
unstructure2Why
unstructure3How
other1Comments 1
other2Comments 2
other3Comments 3
structure1Who
structure2What
structure3Where
unstructured1When
unstructured2Why
unstructured3How
other1Comments 1
other2Comments 2
other3Comments 3
4 REPLIES 4
gabrielvilella
14 - Magnetar

Hi @Rinearb, by looking at your outcome it seems that you just repeated the same data three times. You can simply use a union tool like this:

gabrielvilella_0-1642622774204.png

 

Rinearb
7 - Meteor

It's a good thought to do that, but my real project that I'm working on involves this to happen 21 times. Is there a formula I could use this for to save space?

gabrielvilella
14 - Magnetar

You can use the generate rows tool

gabrielvilella_0-1642623474572.png

 

Rinearb
7 - Meteor

Yes, this worked. I guess I was making this more complicated than I thought. I thought the sort tool would not work in this situation. I used the row generation tool but it repeated the first question 21 times then went to the next.

 

Thanks,

@gabrielvilella

Labels
Top Solution Authors