cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Vadim
Level I

JSL - table transformation

Hello,

 

I have a table consisting of batch number of devices, columns of Bin # and number of devices in this bin.

 

For example for batch #11: bin 18 has 43 devices, bin 19 has 223 devices...

Screenshot 2021-06-28 101643.png

 

Is there a way to transform that table to have columns name as bin# and cell values as number of devices in that bin.

Screenshot 2021-06-28 102046.png

 

Thanks in advance,

Vadim

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL - table transformation

I think the solution is to first stack the 2 groups of columns, and then to split the columns by the stacked bin values.

My Sample data table......your data, just only 4 Chan and 4 #Passed columns

txnelson_0-1624921385182.png

Go to

     Tables=>Stack

and perform a Multiple series stack

txnelson_1-1624921462792.png

It creates a table that looks like:

txnelson_2-1624921611599.png

 

Now go to 

     Tables=>Split

and split the data based upon the column called Data that has the Bin values

txnelson_3-1624921730020.png

It produces the following table which I believe is what you want, minus the exact names for the columns

txnelson_4-1624921820333.png

Here is the steps to do the above in a script,

names default to here(1);

dt = Open("Example.jmp");

// → Data Table( "Example" )
Data Table( "Example" ) << Stack(
	columns(
		:Chan A, :Chan B, :Chan C, :Chan D, :"#Passed A-200"n, :"#Passed B-200"n,
		:"#Passed C-200"n, :"#Passed D-200"n
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" ),
	Number of Series( 2 ),
	Contiguous,
	Output Table("Stacked")
);

// Split data table
// → Data Table( "Untitled 17" )
Data Table( "Stacked" ) << Split(
	Split By( :Data ),
	Split( :Data 2 ),
	Group( :Batch ),
	Remaining Columns( Drop All ),
	Sort by Column Property,
	Output Table( "Final")
);

 

 

 

 

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: JSL - table transformation

Go to the pull down menu

     Tables=>Transpose

Jim
Vadim
Level I

Re: JSL - table transformation

I have tried but with no success

 

Trying to explain better my problem:

 

I created new columns with names Bin 18, Bin 19, Bin 20... I need to fill corresponding columns with values from columns "# Passed X-200".

So for batch 11 columns Bin 18, Bin 19, Bin 20, Bin 21, Bin 22 with 43, 223, 131, 29, 4 respectively. 

 

table question.png

txnelson
Super User

Re: JSL - table transformation

I think the solution is to first stack the 2 groups of columns, and then to split the columns by the stacked bin values.

My Sample data table......your data, just only 4 Chan and 4 #Passed columns

txnelson_0-1624921385182.png

Go to

     Tables=>Stack

and perform a Multiple series stack

txnelson_1-1624921462792.png

It creates a table that looks like:

txnelson_2-1624921611599.png

 

Now go to 

     Tables=>Split

and split the data based upon the column called Data that has the Bin values

txnelson_3-1624921730020.png

It produces the following table which I believe is what you want, minus the exact names for the columns

txnelson_4-1624921820333.png

Here is the steps to do the above in a script,

names default to here(1);

dt = Open("Example.jmp");

// → Data Table( "Example" )
Data Table( "Example" ) << Stack(
	columns(
		:Chan A, :Chan B, :Chan C, :Chan D, :"#Passed A-200"n, :"#Passed B-200"n,
		:"#Passed C-200"n, :"#Passed D-200"n
	),
	Source Label Column( "Label" ),
	Stacked Data Column( "Data" ),
	Number of Series( 2 ),
	Contiguous,
	Output Table("Stacked")
);

// Split data table
// → Data Table( "Untitled 17" )
Data Table( "Stacked" ) << Split(
	Split By( :Data ),
	Split( :Data 2 ),
	Group( :Batch ),
	Remaining Columns( Drop All ),
	Sort by Column Property,
	Output Table( "Final")
);

 

 

 

 

Jim
Vadim
Level I

Re: JSL - table transformation

Thanks a lot!!!