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
);
);