cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar

How do i convert Type'Name" to String in order to get value of Column Property"Spec Limits"

Hi ALL.

I am coder and work for OSAT industry. 

i am trying to make JSL script.

i succeed  getting Column Property "Spec Limits" But  it come as List.

when i get List"Spec Limits" element in order to get value of LSL & USL, the elements type is Name. ( I am not get used to this type & JSL language)

when i try to convert this Name type to String, i couldn't find function(As String).

Q1. is there any function can convert type Name to String?

Q2. If there is no fucntion, how can i parse LSL,USL value from column property "Spec Limits"?

dt = Data Table( "ABC.stdparametric" );
dt << Add Rows( 2, 0 );
number_of_columns = N Col( dt );
//------------------------------------------------------------
start_point = 1; // Initialze the start-point variable. and looking for where testItem start.
For( j = 1, j <= N Col( dt ), j++,
	colName = Column( dt, j ) << Get Name;
	If( colName == "ATR_Present",
		start_point = j; // Assign the column index if the name matches
		Break(); // Exit the loop after finding the first occurrence
	);
);
start_point = start_point + 1;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --For( i = start_point,
	i <= number_of_columns, i++, // from 28-boone;
	columnIndex = 50;
	columnName = Column( dt, columnIndex ) << Get Name;

// Get the specification limits from column
	specLimits = Column( dt, columnIndex ) << Get Property( "Spec Limits" );
	lsl = specLimits[1];
	usl = specLimits[2];
	usl_value = Eval( Parse( usl ) );  // not working

	lsl_value = Eval( Parse( lsl ) );  // not working
	dt:columnName[1] = lsl;
	dt:columnName[2] = usl;
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How do i convert Type'Name" to String in order to get value of Column Property"Spec Limits"

Here is a simple example that shows how to retrieve the numeric value of the LSL and USL from the retrieved Spec Limits List

names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");

specLimits = column( dt, "NPN1" ) << get property( "Spec Limits" );
usl_value = specLimits["USL"];
usl_value = specLimits["LSL"];

There are also some JSL features that will simplify your code.  Below is a modification of your script that you may find advantageous.

dt = Data Table( "ABC.stdparametric"  );
dt << Add Rows( 2, 0 );
number_of_columns = N Col( dt );
//------------------------------------------------------------
/*start_point = 1; // Initialze the start-point variable. and looking for where testItem start.
For( j = 1, j <= N Col( dt ), j++,
	colName = Column( dt, j ) << Get Name;
	If( colName == "ATR_Present",
		start_point = j; // Assign the column index if the name matches
		Break(); // Exit the loop after finding the first occurrence
	);
);*/
columnNames = dt << get column names( string );
start_point = Contains( columnNames, "ATR_Present" ) + 1;
//start_point = start_point + 1;
//------------------------------------------------------------
For( i = start_point, i <= number_of_columns, i++, // from 28-boone;
	//columnIndex = 50;
	//columnName = Column( dt, columnIndex ) << Get Name;

	// Get the specification limits from column
	specLimits = Column( dt, columnNames[i] ) << Get Property( "Spec Limits" );
	/*lsl = specLimits[1];
	usl = specLimits[2];
	usl_value = Eval( Parse( usl ) );  // not working

	lsl_value = Eval( Parse( lsl ) );  // not working
	dt:columnName[1] = lsl;
	dt:columnName[2] = usl;*/
	Column( dt, columnNames[i] )[1] = specLimits["USL"];
	Column( dt, columnNames[i] )[2] = specLimits["LSL"];
);
Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: How do i convert Type'Name" to String in order to get value of Column Property"Spec Limits"

Here is a simple example that shows how to retrieve the numeric value of the LSL and USL from the retrieved Spec Limits List

names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");

specLimits = column( dt, "NPN1" ) << get property( "Spec Limits" );
usl_value = specLimits["USL"];
usl_value = specLimits["LSL"];

There are also some JSL features that will simplify your code.  Below is a modification of your script that you may find advantageous.

dt = Data Table( "ABC.stdparametric"  );
dt << Add Rows( 2, 0 );
number_of_columns = N Col( dt );
//------------------------------------------------------------
/*start_point = 1; // Initialze the start-point variable. and looking for where testItem start.
For( j = 1, j <= N Col( dt ), j++,
	colName = Column( dt, j ) << Get Name;
	If( colName == "ATR_Present",
		start_point = j; // Assign the column index if the name matches
		Break(); // Exit the loop after finding the first occurrence
	);
);*/
columnNames = dt << get column names( string );
start_point = Contains( columnNames, "ATR_Present" ) + 1;
//start_point = start_point + 1;
//------------------------------------------------------------
For( i = start_point, i <= number_of_columns, i++, // from 28-boone;
	//columnIndex = 50;
	//columnName = Column( dt, columnIndex ) << Get Name;

	// Get the specification limits from column
	specLimits = Column( dt, columnNames[i] ) << Get Property( "Spec Limits" );
	/*lsl = specLimits[1];
	usl = specLimits[2];
	usl_value = Eval( Parse( usl ) );  // not working

	lsl_value = Eval( Parse( lsl ) );  // not working
	dt:columnName[1] = lsl;
	dt:columnName[2] = usl;*/
	Column( dt, columnNames[i] )[1] = specLimits["USL"];
	Column( dt, columnNames[i] )[2] = specLimits["LSL"];
);
Jim

Re: How do i convert Type'Name" to String in order to get value of Column Property"Spec Limits"

Thanks Jim.

the solution helped me a lot.

i will study more about how to treat list & element.

jthi
Super User

Re: How do i convert Type'Name" to String in order to get value of Column Property"Spec Limits"

Here are some options

Names Default To Here(1);

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

specs = Column(dt, "NPN1") << Get Property("Spec Limits");
// lsl_val = Arg(specs[1], 1);
// usl_val = Arg(specs[2], 1);
lsl_val = specs["LSL"];
usl_val = specs["USL"];
-Jarmo
Craige_Hales
Super User

Re: How do i convert Type'Name" to String in order to get value of Column Property"Spec Limits"

The other answers are the ones you really want, but the answer to converting names to strings is the char() function which will make some sort of string out of any JSL type.

e = Expr( xyzzy );
Show( Type( Name Expr( e ) ) ); // Type(Name Expr(e)) = "Name";
Show( Char( Name Expr( e ) ) ); // Char(Name Expr(e)) = "xyzzy";
Craige