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?
| Area | Question ID | Questions |
| structure | 1 | Who |
| structure | 2 | What |
| structure | 3 | Where |
| unstructured | 1 | When |
| unstructured | 2 | Why |
| unstructured | 3 | How |
| other | 1 | Comments 1 |
| other | 2 | Comments 2 |
| other | 3 | Comments 3 |
Outcome:
| Area | Question ID | Questions |
| structure | 1 | Who |
| structure | 2 | What |
| structure | 3 | Where |
| unstructured | 1 | When |
| unstructured | 2 | Why |
| unstructured | 3 | How |
| other | 1 | Comments 1 |
| other | 2 | Comments 2 |
| other | 3 | Comments 3 |
| structure | 1 | Who |
| structure | 2 | What |
| structure | 3 | Where |
| unstructure | 1 | When |
| unstructure | 2 | Why |
| unstructure | 3 | How |
| other | 1 | Comments 1 |
| other | 2 | Comments 2 |
| other | 3 | Comments 3 |
| structure | 1 | Who |
| structure | 2 | What |
| structure | 3 | Where |
| unstructured | 1 | When |
| unstructured | 2 | Why |
| unstructured | 3 | How |
| other | 1 | Comments 1 |
| other | 2 | Comments 2 |
| other | 3 | Comments 3 |
Solved! Go to Solution.
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:
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?
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
