Hi,
I wrote a script that 1) queries a table(myDT) to build a control chart on and 2) another table(specLimitsTable) and 3) a loop that takes data from the second table to set spec limits on table 1.
它在 JMP PRO 中运行良好,步骤 1)和 2)在 JMP LIVE 中运行良好,但是当我添加第 3 部分时,它说刷新数据时无法再生。
JMP PRO 中运行的 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].[DDGSControlChartDataBPX]",
"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].[PivotSpecLimitsMediansBPXF]",
"specDTTest"
);
// 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);
Eval(
Eval Expr(
col_ref << Set Property(
"Spec Limits",
{LSL( Expr( lsl ) ), USL( Expr( usl ) ),
Show Limits( 1 )}
)
)
););有几件事要尝试 - 首先,将 Open Table() 结构更改为 New SQL Query()。其次,尝试使用带有“保存到列属性”消息的 Manage Limits() 而不是循环。您可以在脚本索引中找到两者的示例。查询生成器也可用于以图形方式创建查询调用。然后,您可以使用红色三角形菜单选项保存完成的脚本片段。