Link to home
Start Free TrialLog in
Avatar of Charles Baldo
Charles BaldoFlag for United States of America

asked on

All Possible Permutation of a data set order

I have three arrays represented as Body Part, Left and Right, Position standing or sitting.  The array looks like this:
Knee      Standing      Left
Ankle      Sitting      Right
Foot            
Leg            
Hand            
Elbow            
Arm            
 
Body Parts Arm, Hand and Elbow can only have sitting position. Here are all 22 possible combination pairs.  We get this because Arm, Hand and Elbow can only have sitting position:
Knee      Left      Standing
Knee      Left      Sitting
Knee      Right       Standing
Knee      Right       Sitting
Ankle      Left      Standing
Ankle      Left      Sitting
Ankle      Right       Standing
Ankle      Right       Sitting
Foot      Left      Standing
Foot      Left      Sitting
Foot      Right       Standing
Foot      Right       Sitting
Hand      Left      Sitting
Hand      Right       Sitting
Elbow      Left      Sitting
Elbow      Right       Sitting
Arm      Left      Sitting
Arm      Right       Sitting
Leg      Left      Standing
Leg      Left      Sitting
Leg      Right       Standing
Leg      Right       Sitting

I need a permutation with all possible orders.  Here is an output example:

Patient      BodyPart      Laterality      Position
A      Knee      Left      Standing
A      Knee      Right       Standing
B      Foot      Left      Standing
B      Hand      Left      Sitting
C      Elbow      Right       Sitting
D      Elbow      Right       Sitting
E      Arm      Left      Sitting
Avatar of Flyster
Flyster
Flag of United States of America image

You can make 2 tables; one with body part and possible position and a second for laterality. Place those two tables into a query. Because they're not joined, you will get one record each body part, position and laterality. If you make another table for patients and then place that in a query with the first query, you'll have all possible combinations for each patient. See attached.

Flyster
Permutation.accdb
Avatar of Charles Baldo

ASKER

Hello Flyster,

Thank you very much for helping!

Is it possible to make all possible orders of the Permutation results below because the patient are not coming in having the same body parts examed in a row and then next, such as all Knees, all foot and all Arms.  The patients could come in any order.  Please see the example at the bottom.  I think I need all possible orders of the perpermutation results and randomize them.

BodyPart      Position      Laterality
Knee      Standing      Left
Knee      Standing      Right
Knee      Sitting      Left
Knee      Sitting      Right
Ankle      Standing      Left
Ankle      Standing      Right
Ankle      Sitting      Left
Ankle      Sitting      Right
Foot      Standing      Left
Foot      Standing      Right
Foot      Sitting      Left
Foot      Sitting      Right
Leg      Standing      Left
Leg      Standing      Right
Leg      Sitting      Left
Leg      Sitting      Right
Hand      Sitting      Left
Hand      Sitting      Right
Elbow      Sitting      Left
Elbow      Sitting      Right
Arm      Sitting      Left
Arm      Sitting      Right

Patient      BodyPart      Position      Laterality
1      Knee      Standing      Left
2      Knee      Standing      Right
3      Ankle      Standing      Left
4      Ankle      Standing      Right
5      Knee      Standing      Left
5      Knee      Standing      Right
6      Foot      Standing      Left
7      Leg      Standing      Left
8      Knee      Standing      Left
10      Arm      Sitting      Left
ASKER CERTIFIED SOLUTION
Avatar of Flyster
Flyster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank You was helpful