We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Selecting a sample of n random records from a table based on data

Adriankp
8 - Asteroid

Hello,

 

I'm currently in a position where I have to select records from a table randomly, but how many records are to be selected is going to change from run to run, and is based on the result of an API call in the same workflow. So using the Random % Sample tool is unfortunately not a possibility.

 

To break it down, I have one data stream containing a table of records where a random sample has to be made, and one data stream containing information about how many records are to be selected at random from the table (just the number of records in int format). I'm thinking there should be some kind of workaround solution to achieve this, but am currently drawing blanks.

 

Any input is highly appreciated!

 

Thanks!

3 REPLIES 3
gautiergodard
13 - Pulsar

Hello @Adriankp,

I would try a batch macro for this use case.

See below for how i would recommend building.

random.JPG

Hope this helps!

Adriankp
8 - Asteroid

Hi @gautiergodard,

 

I agree a batch macro would be a possible solution. I would if possible like to avoid using additional macros, but understand that might be tougher to achieve.

 

Appreciate the input!

gautiergodard
13 - Pulsar

Got it ! I think that will be your best bet! 

 

If you find a better solution, please post on this thread! @Adriankp 

Labels
Top Solution Authors