Alteryx Designer Desktop Discussions

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

Append to the same table

rjkuppeveld
5 - Atom

Hi,

 

In SQL you can create a table and a loop and in the loop you add everytime a record to the same table

 

create table table_A

(  ID.    Integer,

   Desc varchar

)

 

declare @loop int

 

set @loop = 1

 

while @loop < 10 

BEGIN

      Insert into table_A

      Values(@loop, ‘some text’)

      Set @loop = @loop + 1

END

 

How can I do this in Alteryx?

 

I played with the iteration Marco, but I can't find the option to append to the same table

 

Any idea how to do this?

 

thanks

 

RJ

 

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus

You can do this with an iterative macro:

2018-12-18_17-49-25.png

 

Basically:

- Build an initial row

- Then in the iterative macro, you build a new row. The Engine.IterationNumber will work as a Loop variable

- You then union the input to the new row (which must match exactly)

- You can use a filter to decide if to loop or not based on value of IterationNumber

 

Quick sample attached

 

rjkuppeveld
5 - Atom

Thank you very much for this.

 

best regards,

 

RJ

 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels