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
jsluser
Level I

How to set the value of a cell using character data stored in a variable?

Hi everyone,

 

I want to take the character value of a certain cell and transfer it over to 18 rows in a new data table.

 

I am having issues with the variables col1, col2, and col3 since their data type is character and only contains a single cell value. I cannot find a way to use this variable to populate rows 1-18 of my new table.

 

Here is a small sample of my code:

 

col1 = Column(dt,"PCMTest-A")[12::12];
col2 = Column(dt,"PCMTest-A")[13::13];
col3 = Column(dt,"PCMTest-A")[10::10];
col4 = Column(dt,"PCMTest-A")[39::56];

 

dt2 = NewTable("Result",
Add Rows(18),
NewColumn("Lot Name", Character, Values(col1)),
NewColumn("Wafer Name", Character, Values(col2)),
NewColumn("Mask", Character, Values(col3)),
NewColumn("X", Character, Values(col4)),

);

 

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to set the value of a cell using character data stored in a variable?

It looks like you just need to either repeat the value when setting values in the new column, or use the value in a formula.  Here is an example:

 

Names default to here( 1 );

dt1 = New Table( "Input",
	Add Rows( 3 ),
	New Column( 
		"Column 1", Character, "Nominal",
		Set Values( {"a", "b", "c"} )
	)
);

val1 = Column( dt1, "Column 1" )[1];
val2 = Column( dt1, "Column 1" )[2];
vals123 = Column( dt1, "Column 1" )[1::3];

dt2 = New Table( "Output", 
	Add rows( 3 ),
	New Column( "Column 1", Character, "Nominal", Set Values( vals123 ) ),
	New Column( "Column 2", Character, "Nominal", Set Values( repeat( {val1}, 3 ) ) ),
	New Column( "Column 3", Character, "Nominal", Formula( val2 ) )
);

View solution in original post

1 REPLY 1
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to set the value of a cell using character data stored in a variable?

It looks like you just need to either repeat the value when setting values in the new column, or use the value in a formula.  Here is an example:

 

Names default to here( 1 );

dt1 = New Table( "Input",
	Add Rows( 3 ),
	New Column( 
		"Column 1", Character, "Nominal",
		Set Values( {"a", "b", "c"} )
	)
);

val1 = Column( dt1, "Column 1" )[1];
val2 = Column( dt1, "Column 1" )[2];
vals123 = Column( dt1, "Column 1" )[1::3];

dt2 = New Table( "Output", 
	Add rows( 3 ),
	New Column( "Column 1", Character, "Nominal", Set Values( vals123 ) ),
	New Column( "Column 2", Character, "Nominal", Set Values( repeat( {val1}, 3 ) ) ),
	New Column( "Column 3", Character, "Nominal", Formula( val2 ) )
);