大家好,
我对 JMP 尤其是 JSL 脚本编写还比较陌生。我正在寻找一种将现有脚本应用于所有当前打开的数据表(通过多个文件导入导入)的方法。尽管我研究了有关该主题的大量社区帖子,但我无法拼凑出一个可行的解决方案。
好的,我有以下工作 JSL 代码(注意:嵌入到工作流程中,如果相关的话):
// Specify the dataset and the suffix to search for in column headers
dt = Current Data Table();
// Define suffix of interest for replacement
targetSuffix = "TimeAbs";
// Get list of column names from the current data table
colNames = dt << Get Column Names( "string" );
// Loop through all column names and check if the target suffix is present
For( i = 1, i <= N Items( colNames ), i++,
If( Contains( colNames[i], targetSuffix ),
// If the target suffix is found, change the column header to "Date"
Column( dt, colNames[i] ) << Set Name( "Date" )
)
);工作流程的当前功能是替换当前打开的数据表中的列名称,但是该名称在文件之间可能有所不同,这就是为什么我决定只搜索固定后缀。
我现在想扩展此脚本以应用于我当前打开的多个数据表。我已经看到过基于 For 或 For Each 循环以及表脚本的类似任务的解决方案,但正如我所说,我对 JSL 还很陌生,到目前为止还没有成功。
此外,这需要非常通用,因为文件名和列名可能会有很大差异。
最终目标是连接这些表,但可能超出了单个问题的范围。
非常感谢您的任何建议或想法