Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Random value generation from a list

akshatkumar87
7 - Meteor

Hey Guys,

 

Trying to create some dummy data for a project. I have sample dataset of 1000 doctors and there is a feild called speciality which has certain list of values i want to randomly allocate each docter value from that very list of 10 values.

 

Sample data

Docid    Docname 

1           A

2           B

3           C

4           D

 

Speciality

Oconology

Dentist

 

My output should be randomly generated as :

 

Docid  Docname Speciality

1            A             Dentist

2            B             Oconology

3            C             Dentist

4            D             Dentist

 

Thank you in advance

11 REPLIES 11
DultonM
11 - Bolide

Hi akshatkumar87,

 

To clarify, you want to randomly assign one of 10 specialties to each doctor in your dataset?

 

Check out the attached workflow. I use the RandInt function in a formula tool to create a random integer for each doctor. I then join that to a list of the specialties, each with their own assigned integer. Here is a picture of the workflow too.

 

Randomly Assign Doctor Type.PNG

Hope this helps! Please mark this post as the solution if it does!

 

--DultonM

akshatkumar87
7 - Meteor

Hey Dulton,

 

Thank you so much for your response actually i am not being able to see your solution can you reupload for 10.1 version of it i have the older version ?

 

Also i need randomly assign values of already generated values for Docter...  I already have a list of 10 speciality.

 

Thanks again

MarqueeCrew
20 - Arcturus
20 - Arcturus

You can use my macro https://gallery.alteryx.com/#!app/Modify-Alteryx-Workflow-Version/5773f9c33df7da0e58dc82d3 to modify the yxmd to your version. Create a new workflow with the macro as the only tool and it will change the version so that you can open it. 

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Federica_FF
11 - Bolide

Hi!

 

Open the workbook with any text editor and replace 10.5 you can find at the second row with 10.1

 

<AlteryxDocument yxmdVer="10.5">

replace with

<AlteryxDocument yxmdVer="10.1">

 

Then save and you will be able to open the workflow.

akshatkumar87
7 - Meteor

Replacing version didnt work

DultonM
11 - Bolide

Thanks for version work-arounds Mark and Federica! 

 

akshatkumar87 - I'm surprised the version change did not work. I made Federica's edit to the XML on my end and reattached, but that may not work for you either. Are you sure you have 10.1?

 

Maybe I can explain a little more so you don't need my workflow. If you look back at the picture from my last post, the top right text input simply assigns an integer to each specialty like this:

 

0Oconology
1Dentist
2Radiology
3etc
4etc
5etc
6etc
7etc
8etc
9etc
10etc

 

The Join compares the random number from the formula tool (formula = "RandInt(9)" so the randomly generated integers go from 0 to 9, giving you 10 numbers to correspond to your specialties) to the integer in the first column of the table above, effectively assigning a specialty to each doctor randomly. The Select and Sort tools are just there to reorganize the data.

jdunkerley79
ACE Emeritus
ACE Emeritus

You need to replace the yxmdVer version with 10.0 for version 10.1

akshatkumar87
7 - Meteor

I got the concept now thanks a lot !!

DultonM
11 - Bolide

Awesome!! You are welcome!

Labels