大家好,
我對 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 還很陌生,到目前為止還沒有成功。
此外,這需要非常通用,因為檔案名稱和列名可能會有很大差異。
最終目標是連接這些表,但可能超出了單一問題的範圍。
非常感謝您的任何建議或想法