Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Use variable to generate data

Yury_Brunt
7 - Meteor

Hi,

 

Please see my example attached. I need to generate some sample data for simulation purposes.

With the multi row tool ID's are added to the data (see comment in workflow), this is bases on a fixed number of rows, the next step is to group them

I need the number of row's to be variable. Let's say between 1 and 10. 

 

Is there any way to do that?

 

Thanks,

Yury

7 REPLIES 7
danrh
13 - Pulsar

Something like the attached?  Each time this is run, it will produce a random number from 1 to 10, and the grouping will be based on that value.

 

CharlieS
17 - Castor
17 - Castor

@Yury_Brunt

 

In a Formula tool I used the RandInt( function to produce a random group size, then generated rows for each group. This is highly likely to produce a list of group assignments larger than the records, but I just used a position-based Join to used the necessary group assignments back to the original.

 

Solution attached.

CharlieS
17 - Castor
17 - Castor

EDIT: Removed.

Yury_Brunt
7 - Meteor

Thanks @CharlieS, nice solution think this can do the trick.

Yury_Brunt
7 - Meteor

Thanks @Quasar, but i needed the individual groups to be variable from size.

danrh
13 - Pulsar

Ah, I gotcha.  I thought you were saying a random size of group, but each group the same size.

 

For the sake of giving multiple options, so here's another solution to go along with @CharlieS's.  Wanted to see if I could get it all in a single stream :)

CharlieS
17 - Castor
17 - Castor

Very nice solution, @danrh

Labels