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
bjbreitling
Level IV

Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.

My code to do this is below. Im not getting errors but its not working. I check the columns and they don't have the spec limits. The log is showing the following:

spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name << Get Data Type() = "Character";
:LSL << Get Data Type() = "Numeric";
"Column:";
column_name = "MST";
"LSL:";
lsl = 9;
"USL:";
usl = 12.5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name << Get Data Type() = "Character";
:LSL << Get Data Type() = "Numeric";
"Column:";
column_name = "FIBER";
"LSL:";
lsl = 7;
"USL:";
usl = 9;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name << Get Data Type() = "Character";
:LSL << Get Data Type() = "Numeric";
"Column:";
column_name = "SULFUR";
"LSL:";
lsl = 1;
"USL:";
usl = 1.5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name << Get Data Type() = "Character";
:LSL << Get Data Type() = "Numeric";
"Column:";
column_name = "FAT";
"LSL:";
lsl = 3;
"USL:";
usl = 5;
spec_limits = {LSL(lsl), USL(usl), Show Limits(1)};
:Column_Name << Get Data Type() = "Character";
:LSL << Get Data Type() = "Numeric";
"Column:";
column_name = "PROTEIN";
"LSL:";
lsl = 24;
"USL:";
usl = 27;

 

Here is the JSL Script:

<JSL>

myDT = Open Database(
    "APP=JMP;DATABASE=BBAnalytics;DRIVER={SQL Server};Description=BB Analytics Data Warehouse;Trusted_Connection=Yes;UID=%_UID_%;WSID=SFX-JPCZ724;SERVER=SFX-DWA01;DBCNAME=SFX-DWA01;",
    "SELECT * FROM [dbo].[myDT]",
    "myDT"
);

specLimitsTable = Open Database(
    "APP=JMP;DATABASE=BBAnalytics;DRIVER={SQL Server};Description=BB Analytics Data Warehouse;Trusted_Connection=Yes;UID=%_UID_%;WSID=SFX-JPCZ724;SERVER=SFX-DWA01;DBCNAME=SFX-DWA01;",
    "SELECT * FROM [dbo].[specDTTest]",
    "specDTTest"
);

// Iterate over the rows of the spec limits table
// Iterate over the rows of the spec limits table
For Each Row(specLimitsTable,
    // Get values from the current row
    column_name = Column(specLimitsTable, "Column_Name")[Row()];
    lsl = Column(specLimitsTable, "LSL")[Row()];
    usl = Column(specLimitsTable, "USL")[Row()];

    // Set spec limits for the corresponding column in the main data table
    col_ref = Column(myDT, column_name);
    col_ref << Set Property(
        "Spec Limits",
        {LSL(lsl), USL(usl), Show Limits(1)}
    );
	spec_limits = Column(myDT, column_name) << Get Property("Spec Limits");
	Show(spec_limits);
	show(column_name << Get Data Type());
	show(lsl << Get Data Type());
    // Show the applied spec limits for each column
    Show(
        "Column:", column_name,
        "LSL:", lsl,
        "USL:", usl
    );
);

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.

You are attempting to have JMP evaluate the contents of a JMP List.  Since a JMP List can contain just about anything, lists are not evaluated.  However, a wrapper can be placed around the code to evaluate the contents, and then be submitted to JMP for processing.  Try changing your Spec Limits code to

Eval(
	Eval Expr(
		col_ref << Set Property(
			"Spec Limits",
			{LSL( Expr( lsl ) ), USL( Expr( usl ) ),
			Show Limits( 1 )}
		)
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.

You are attempting to have JMP evaluate the contents of a JMP List.  Since a JMP List can contain just about anything, lists are not evaluated.  However, a wrapper can be placed around the code to evaluate the contents, and then be submitted to JMP for processing.  Try changing your Spec Limits code to

Eval(
	Eval Expr(
		col_ref << Set Property(
			"Spec Limits",
			{LSL( Expr( lsl ) ), USL( Expr( usl ) ),
			Show Limits( 1 )}
		)
	)
);
Jim
bjbreitling
Level IV

Re: Im trying to write a script (so i can use it for JMP live) to dynamically apply spec limits queryed from another table.

Thanks! This did the trick!