以下场景:我为我的一位海外同事编写了一个脚本。该脚本可从数据库加载数据,将数据组织到表中,并将用于控制图的表脚本放入表中。该表包含几个不同的产品/流程,而这个表脚本仅针对其中一种(即所有行中的一小部分)。当我在计算机上运行主脚本和表脚本时,它们运行良好。当我的海外同事运行它们时(我在电话中看到他的屏幕上显示),他可以从数据库中顺利获取表,并且表脚本可以执行,但在控制图中应该表示的行选择方面确实会失败。它使用了数百甚至数千个来自错误子集的不相关行。
在表格脚本中,我没有使用“名称默认为此处 (1);”。我的同事安装了不同的 JMP 版本(17.0 与 17.2),我没想到这有什么关系。作为第一次回应,我发送了一份使用首选项管理器(带导入/导出)导出的首选项副本,但这并没有帮助解决问题。
然后,他向我发送了他的表格的副本,当我检查其中的表格脚本时,我发现与在计算机上从顶部执行脚本时表格脚本的样子有细微的差别:
在我的电脑上:

在我同事的电脑上:

然而,当我在计算机上运行他生成并通过电子邮件发送给我的表格副本中的表格脚本(即底部版本)时,表格脚本按预期执行。唉,我完全不知道这里发生了什么。
这个问题的根源是什么?我们如何修复这个问题并避免将来再次出现?有什么最佳实践吗?谢谢!
JMP 维护版本之间肯定会存在差异,这可能会导致各种各样的差异/问题。
如果您的同事将脚本与表脚本分开,将 Names Default To Here(1) 添加到脚本开头并从单独的脚本窗口运行该脚本,那么该脚本是否可以正常工作?
- 本地数据格式的差异确实会搞乱查询。(这可能是由操作系统本地决定的)
- 自 v14 以来的版本差异很少引起问题。
-如果你有更新更快的计算机和数据库连接,而你的大学的计算机速度很慢,并且与数据库的网络连接很差,那么这可能是一个问题。(可能需要添加一些 wait(); 或 dt<

是由颜色不明物体的消息引起的:

总体来说,这个设置非常有用 - 如果你接受一些“已知”的也会被着色。
“未知”消息的缺点:无法通过以下方式打开脚本索引

@jthi ,当我要求我的海外同事按照您建议的诊断程序进行操作时,问题也是一样。
@Byron_JMP ,正如我在视频会议中看到的那样,初始脚本的执行速度与我所在位置的执行速度大致相同。我还猜测我们公司的笔记本电脑的规格都相对相似。令人困惑的是,当我的同事通过电子邮件将他从第一个或“主”脚本中获得的初始表发送给我,然后我在其中执行表脚本时,它所做的正是我所期望的。所以也许线路速度不是问题
@hogi我没有激活此设置,因此就我的情况而言(并且我从我的计算机上的 JMP 安装中截取了屏幕截图),看起来好像脚本编辑器本身仅在“<<”和“message”之间有换行符时才对消息(如变量)进行颜色编码,而无论“<<”和“message”之间有没有换行符,它的执行情况都完全相同,完全独立于颜色编码。
不过,我想我可能已经将问题缩小了一点。我在下面复制了我希望表格脚本执行的操作、它在我的 JMP 安装中的样子以及它在同事的机器上执行的操作。
// what i want the table script to do
Data Table( "table_1" ) << Clear Selection;
Data Table( "table_1" ) << Clear Column Selection;
Table_2 = Data Table( "table_1" ) << Subset(
Filtered Rows(
Contains( :Category_1, "some_category" ) & Contains( :Category_2, "some_other_category" )
)
);
Table_3 = Table_2 << Split(
Split By( :Col_1, :Col_2 ),
Split( :Col_3 ),
Group( :Col_4, :Category_1, :Category_2 ),
Output Table( "table_3" ),
Remaining Columns( Drop All ),
Sort by Column Property
);
// what the table script looks like on my computer
// it does exactly the same as the above version, despite the line break before 'Subset'
Data Table( "table_1" ) << Clear Selection;
Data Table( "table_1" ) << Clear Column Selection;
Table_2 = Data Table( "table_1" ) <<
Subset(
Filtered Rows(
Contains( :Category_1, "some_category" ) & Contains( :Category_2, "some_other_category" )
)
);
Table_3 = Table_2 << Split(
Split By( :Col_1, :Col_2 ),
Split( :Col_3 ),
Group( :Col_4, :Category_1, :Category_2 ),
Output Table( "table_3" ),
Remaining Columns( Drop All ),
Sort by Column Property
);
// what it appears to be doing on my colleagues computer
Data Table( "table_1" ) << Clear Selection;
Data Table( "table_1" ) << Clear Column Selection;
Data Table( "table_1" ) << Split(
Split By( :Col_1, :Col_2 ),
Split( :Col_3 ),
Group( :Col_4, :Category_1, :Category_2 ),
Output Table( "table_3" ),
Remaining Columns( Drop All ),
Sort by Column Property
);
也许解决办法是像这样修改表脚本?
// a solution to be tested?
Data Table( "table_1" ) << Clear Selection;
Data Table( "table_1" ) << Clear Column Selection;
Wait(); // this would be the new part per Byron's suggestion
Table_2 = Data Table( "table_1" ) << Subset(
Filtered Rows(
Contains( :Category_1, "some_category" ) & Contains( :Category_2, "some_other_category" )
)
);
Table_3 = Table_2 << Split(
Split By( :Col_1, :Col_2 ),
Split( :Col_3 ),
Group( :Col_4, :Category_1, :Category_2 ),
Output Table( "table_3" ),
Remaining Columns( Drop All ),
Sort by Column Property
);
您觉得如何?非常感谢您迄今为止提供的帮助,也感谢您提出的任何其他意见。如果我弄清楚了问题所在,我一定会在这里发布。
我建议添加 Wait(0); 而不是 Wait(),因为 Wait() 默认为 3 秒。

您还可以更改过滤后的行以获取行(至少可以使调试更容易)
rows_of_interest = Data Table("table_1") << Get Rows Where(Contains(:Category_1, "some_category") & Contains(:Category_2, "some_other_category"));
Table_2 = Data Table("table_1") << Subset(
Rows(rows_of_interest)
);非常感谢@jthi !单独添加“wait(0)”不起作用。使用您的“rows_of_interest”方法成功了。我仍然觉得这很奇怪。
@Byron_JMP 、 @hogi——仅供参考,感谢您提出的建议。