cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Jackie_
Level VI

Using Parse in contain

Hi,

I am trying to iterate through the list and get the values from the summary_tb into the lists L1, L2, L3 if contained in Lists 1,2,3,4. I am stuck with Prase(lists[j]). Any advice? Thanks

 

 


dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

List1 = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1"};
List2 = {"PNP4", "NPN3", "IVP2", "NPN4", "SIT1"};
List3 = {"INM1", "INM2", "VPM1", "VPM2", "VPM3"};
List4 = {"SNM1", "SPM1", "NPN5", "EP2", "ZD6"};

summary_tb = (Data Table( "Semiconductor Capability" ) << Tabulate(
	Add Table(
		Column Table( Statistics( N, Mean, Std Dev ) ),
		Row Table(
			Analysis Columns(
				:NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1, :PNP4, :NPN3, :IVP2, :NPN4, :SIT1, :INM1, :INM2, :VPM1, :VPM2, :VPM3, :PMS1, :SNM1, :SPM1,
				:NPN5, :EP2, :ZD6, :PBA, :PLG, :CAP, :PBA3, :PLG2, :PNP5, :NPN6, :PNP6, :PNP7, :NPN7, :PNP8, :IVP3, :IVP4, :IVP5, :IVP6, :PNP9, :NPN8,
				:NPN9, :IVP7, :NPN10, :N_1, :PBA1, :WPR1, :B10, :PLY10, :VBE210, :VTN210, :VTP210, :SIT2, :SIT3, :INV2, :INV3, :INV4, :INV5, :FST1,
				:FST2, :RES1, :RES2, :PNM1, :PPM1, :FNM1, :FPM1, :FST3, :FST4, :RES3, :RES4, :A1, :B1, :A2N, :A2P, :A2P1, :IVP8, :IVP9, :DE_H1,
				:NF_H1, :ESM1, :ESM2, :ESP1, :YFU1, :VPM4, :PBA2, :PBB1, :LYA1, :LYB1, :DEM1, :DEP1, :NFM1, :PLY1, :VDP1, :VDP2, :SNW1, :RSP2, :PLY2,
				:RSP1, :VDP3, :PBL1, :PLG1, :VDP4, :SPW1, :VIA1, :INM3, :VPM5, :VPM6, :INM4, :VPM7, :M1_M1, :M2_M2, :P1_P1, :E2A1, :E2B1, :NPN11,
				:IVP10, :PNP10, :INM5, :VPM8, :VPM9, :INM6, :VPM10, :N2A1, :N2B1, :NM_L1, :P2A1, :P2B1, :PM_L1, :P1, :M1
			)
		)
	)
)) << Make Into Data Table;

lists = {"List1", "List2", "List3", "List4"};
///Get values from the below loop into these lists L1 = {}; L2 = {}; L3 = {};

// Loop to iterate rows and lists to find the column values from the tabulate table For( i = 1, i <= N Rows( summary_tb ), i++, For( j = 1, j <= N Items( lists ), j++, //// Something is not correct in the below code If( Contains( Parse (lists[j]) ,Column( summary_tb, 1 )[i]), Insert Into( L1, Column( summary_tb, 1 )[i] ); Insert Into( L2, Column( summary_tb, 2 )[i] ); Insert Into( L3, Column( summary_tb, 3 )[i] ); ) ) );
4 REPLIES 4
txnelson
Super User

Re: Using Parse in contain

I was able to get the result you specified by using the Substitute function

lists = {"List1", "List2", "List3", "List4"};
///Get values from the below loop into these lists
L1 = {};
L2 = {};
L3 = {};// Loop to iterate rows and lists to find the column values from the tabulate table
For( i = 1, i <= N Rows( summary_tb ), i++,
	For( j = 1, j <= N Items( lists ), j++, 

//// Something is not correct in the below code
		Eval(
			Substitute(
					Expr(
						If( Contains( __lists__, Column( summary_tb, 1 )[i] ), 
						
							Insert Into( L1, Column( summary_tb, 1 )[i] );
							Insert Into( L2, Column( summary_tb, 2 )[i] );
							Insert Into( L3, Column( summary_tb, 3 )[i] );
						)
					),
				Expr( __lists__ ), Parse( lists[j] )
			)
		)
	)
);
Jim
Jackie_
Level VI

Re: Using Parse in contain

Thanks Jim!

Jackie_
Level VI

Re: Using Parse in contain

@txnelson 

Quick question - I want to get the a values in the tab box table box for each of the list

For instance, 

The first tab box should have the following summary stats

List1 = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1"};

The 2nd tab box should have the following summary stats
List2 = {"PNP4", "NPN3", "IVP2", "NPN4", "SIT1"};

Likewise for 3 and 4

I tried using set function but it copies all the columns in the one tab. Any suggestions?

 

 


dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

List1 = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1"};
List2 = {"PNP4", "NPN3", "IVP2", "NPN4", "SIT1"};
List3 = {"INM1", "INM2", "VPM1", "VPM2", "VPM3"};
List4 = {"SNM1", "SPM1", "NPN5", "EP2", "ZD6"};

summary_tb = (Data Table( "Semiconductor Capability" ) << Tabulate(
	Add Table(
		Column Table( Statistics( N, Mean, Std Dev ) ),
		Row Table(
			Analysis Columns(
				:NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1, :PNP4, :NPN3, :IVP2, :NPN4, :SIT1, :INM1, :INM2, :VPM1, :VPM2, :VPM3, :PMS1, :SNM1, :SPM1,
				:NPN5, :EP2, :ZD6, :PBA, :PLG, :CAP, :PBA3, :PLG2, :PNP5, :NPN6, :PNP6, :PNP7, :NPN7, :PNP8, :IVP3, :IVP4, :IVP5, :IVP6, :PNP9, :NPN8,
				:NPN9, :IVP7, :NPN10, :N_1, :PBA1, :WPR1, :B10, :PLY10, :VBE210, :VTN210, :VTP210, :SIT2, :SIT3, :INV2, :INV3, :INV4, :INV5, :FST1,
				:FST2, :RES1, :RES2, :PNM1, :PPM1, :FNM1, :FPM1, :FST3, :FST4, :RES3, :RES4, :A1, :B1, :A2N, :A2P, :A2P1, :IVP8, :IVP9, :DE_H1,
				:NF_H1, :ESM1, :ESM2, :ESP1, :YFU1, :VPM4, :PBA2, :PBB1, :LYA1, :LYB1, :DEM1, :DEP1, :NFM1, :PLY1, :VDP1, :VDP2, :SNW1, :RSP2, :PLY2,
				:RSP1, :VDP3, :PBL1, :PLG1, :VDP4, :SPW1, :VIA1, :INM3, :VPM5, :VPM6, :INM4, :VPM7, :M1_M1, :M2_M2, :P1_P1, :E2A1, :E2B1, :NPN11,
				:IVP10, :PNP10, :INM5, :VPM8, :VPM9, :INM6, :VPM10, :N2A1, :N2B1, :NM_L1, :P2A1, :P2B1, :PM_L1, :P1, :M1
			)
		)
	)
)) << Make Into Data Table;

lists = {"List1", "List2", "List3", "List4"};

L1 = {};
L2 = {};
L3 = {};

For( i = 1, i <= N Rows( summary_tb ), i++,
	For( j = 1, j <= N Items( lists ), j++, 

//// Something is not correct in the below code
		Eval(
			Substitute(
					Expr(
						If( Contains( __lists__, Column( summary_tb, 1 )[i] ), 
						
							Insert Into( L1, Column( summary_tb, 1 )[i] ); // Test
							Insert Into( L2, Column( summary_tb, 2 )[i] ); // N
Insert Into( L3, Column( summary_tb, 3 )[i] );// Mean Insert Into( L4, Column( summary_tb, 3 )[i] ); // Std ) ), Expr( __lists__ ), Parse( lists[j] ) ) ) ) ); Nw = New Window( "", Tab Box( "1", V List Box( tbb = Table Box( tests = String Col Edit Box( "Tests", {} ), num = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ), mean1 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ), std = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), ) ), "2", V List Box( tbb = Table Box( tests = String Col Edit Box( "Tests", {} ), num = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ), mean1 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ), std = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), ) ), "3", V List Box( tbb = Table Box( tests = String Col Edit Box( "Tests", {} ), num = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ), mean1 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ), std = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), ) ), "4", V List Box( tbb = Table Box( tests = String Col Edit Box( "Tests", {} ), num = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ), mean1 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ), std = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), ) ) ) ); tests << set(L1);
num<< set(L2);
mean1<< set(L3);
std<< set(L4);

 

 

txnelson
Super User

Re: Using Parse in contain

The variables Tests, num, mean1 and std keep getting changed from the Display Objects in Tab 1, to Tab 2......Tab 4.  If you want to send your <<Set messages to each of them, you need to have different pointers to them.  See the code below

dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );

List1 = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1"};
List2 = {"PNP4", "NPN3", "IVP2", "NPN4", "SIT1"};
List3 = {"INM1", "INM2", "VPM1", "VPM2", "VPM3"};
List4 = {"SNM1", "SPM1", "NPN5", "EP2", "ZD6"};

summary_tb = (Data Table( "Semiconductor Capability" ) << Tabulate(
	Add Table(
		Column Table( Statistics( N, Mean, Std Dev ) ),
		Row Table(
			Analysis Columns(
				:NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1, :PNP4, :NPN3, :IVP2, :NPN4, :SIT1, :INM1, :INM2,
				:VPM1, :VPM2, :VPM3, :PMS1, :SNM1, :SPM1, :NPN5, :EP2, :ZD6, :PBA, :PLG, :CAP, :PBA3, :PLG2,
				:PNP5, :NPN6, :PNP6, :PNP7, :NPN7, :PNP8, :IVP3, :IVP4, :IVP5, :IVP6, :PNP9, :NPN8, :NPN9,
				:IVP7, :NPN10, :N_1, :PBA1, :WPR1, :B10, :PLY10, :VBE210, :VTN210, :VTP210, :SIT2, :SIT3,
				:INV2, :INV3, :INV4, :INV5, :FST1, :FST2, :RES1, :RES2, :PNM1, :PPM1, :FNM1, :FPM1, :FST3,
				:FST4, :RES3, :RES4, :A1, :B1, :A2N, :A2P, :A2P1, :IVP8, :IVP9, :DE_H1, :NF_H1, :ESM1, :ESM2,
				:ESP1, :YFU1, :VPM4, :PBA2, :PBB1, :LYA1, :LYB1, :DEM1, :DEP1, :NFM1, :PLY1, :VDP1, :VDP2,
				:SNW1, :RSP2, :PLY2, :RSP1, :VDP3, :PBL1, :PLG1, :VDP4, :SPW1, :VIA1, :INM3, :VPM5, :VPM6,
				:INM4, :VPM7, :M1_M1, :M2_M2, :P1_P1, :E2A1, :E2B1, :NPN11, :IVP10, :PNP10, :INM5, :VPM8,
				:VPM9, :INM6, :VPM10, :N2A1, :N2B1, :NM_L1, :P2A1, :P2B1, :PM_L1, :P1, :M1
			)
		)
	)
)) << Make Into Data Table;

lists = {"List1", "List2", "List3", "List4"};

L1 = {};
L2 = {};
L3 = {};
L4 = {};

For( i = 1, i <= N Rows( summary_tb ), i++,
	For( j = 1, j <= N Items( lists ), j++, 

//// Something is not correct in the below code
		Eval(
			Substitute(
					Expr(
						If( Contains( __lists__, Column( summary_tb, 1 )[i] ), 
						
							Insert Into( L1, Column( summary_tb, 1 )[i] ); // Test
							Insert Into( L2, Column( summary_tb, 2 )[i] ); // N
							Insert Into( L3, Column( summary_tb, 3 )[i] );// Mean
							Insert Into( L4, Column( summary_tb, 3 )[i] ); // Std
						)
					),
				Expr( __lists__ ), Parse( lists[j] )
			)
		)
	)
);

Nw = New Window( "", 
	
	
	Tab Box(
		"1", 
		
		V List Box(
			
			tbb1 = Table Box(
				tests1 = String Col Edit Box( "Tests", {} ),
				num1 = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ),
				mean11 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ),
				std1 = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), 
				
													
			)
			
		),
		"2",
		V List Box(
			tbb2 = Table Box(
				tests2 = String Col Edit Box( "Tests", {} ),
				num2 = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ),
				mean12 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ),
				std2 = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), 
				
													
			)
		),
		"3",
		V List Box(
			tbb3 = Table Box(
				tests3 = String Col Edit Box( "Tests", {} ),
				num3 = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ),
				mean13 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ),
				std3 = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), 
				
													
			)
		),
		"4",
		V List Box(
			tbb4 = Table Box(
				tests4 = String Col Edit Box( "Tests", {} ),
				num4 = Number Col Edit Box( "N", {}, <<set format( "Fixed Dec", 12 ) ),
				mean14 = Number Col Edit Box( "Mean", {}, <<set format( "Fixed Dec", 12, 2 ) ),
				std4 = Number Col Edit Box( "Std", {}, <<set format( "Fixed Dec", 12, 2 ) ), 
				
													
			)
		)
		
		
		
		
	)
);

tests1 << set( L1 );
num1 << set( L2 );
mean11 << set( L3 );
std1 << set( L4 );
tests2 << set( L1 );
num2 << set( L2 );
mean12 << set( L3 );
std2 << set( L4 );
tests3 << set( L1 );
num3 << set( L2 );
mean13 << set( L3 );
std3 << set( L4 );
tests4 << set( L1 );
num4 << set( L2 );
mean14 << set( L3 );
std4 << set( L4 );
Jim