如何一次將腳本套用到多個資料表? (JMP 17)我正在尋找一種透過執行一次腳本來跨多個資料表執行腳本的方法,而不是每個資料表執行一次腳本。
目前資料流
- 開啟參考 JMP 資料表。
- 使用第一個腳本(基於多個檔案匯入)將多個 Excel 檔案匯入多個 JMP 資料表(每個檔案 1 個表格)。
- 結果:開啟 1 個參考資料表,並透過匯入腳本建立 2-10 多個新 JMP 資料表。
- 運行一個第二個腳本在每個建立的 JMP 資料表上清理資料並使用參考 JMP 資料表中的資料更新所建立的資料表。
- 結果:1 個參考資料表和 2-10+ 個 JMP 資料表已被清理(刪除列、新增計算列等)並已使用參考資料表中的資料進行更新(腳本化更新資料表)。
我想找到一個無需手動應用我的解決方案第二個腳本分別加入到每個建立的 JMP 資料表。
我對任何方法都持開放態度。
我曾考慮嘗試使用 JMP 列表和/或“For Each”函數,但我一直無法找到將這些應用到資料表的範例。 我想我需要列出所有打開的資料表,並按其名稱進行過濾(這樣我就可以過濾掉用於更新感興趣的資料表的參考資料表),我也不知道該怎麼做。
感謝您提供的任何建議和想法。
自動化和腳本編寫回覆:如何一次將腳本應用於多個資料表? (JMP 17)謝謝你們倆。 非常感謝您的幫忙。
; //with all Multiple File Import details included
</CODE></PRE><P>絕對適合製作清單。</P><P> </P><P>我無法讓它為自己工作,但我仍在學習如何使用 Eval、EvalExpr、Expr 等。</P><PRE><CODE class=" language-jsl">Eval( // For each loop adds table_script to each data table named in dt_list
Eval Expr(
For Each( {value, index},
Expr( dt_list[index] << table_script )
)
)
);dt_list = Multiple File Import()
我能夠獲得一個簡單的測試來使用這種格式的 For Each。 簡單的新增列腳本。
For Each({listitem}, dt_list, listitem << New Column( "Mean",
Numeric,
"Continuous",
Formula( Mean( :A, :B, :C, :D</img> ) ),
Format( "Best", 12 )));我完整的工作範例程式碼是
Names default to here(1);
dt_list = Multiple File Import(
<<SET folder=""> ) ),
Format( "Best", 12 )));
</SET>
回覆:如何一次將腳本應用於多個資料表? (JMP 17)你好@卡斯特,
後續是什麼@jthi提及。 執行此操作的腳本可能如下所示。正確的表達式語法對我來說仍然有點模糊,但這應該是您所需要的大部分方式。
Names default to here(1);
dt_list = Multiple file import(); // Incomplete placeholder
table_script = expr( New script( "Table script name here", // Add new tables scripts with New script()
Graph Builder( // Incomplete table script graphic script
Size( 800, 800 ),
Show Control Panel( 0 ),
Variables( X( :Column 1 ) ),
Elements( Points( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "Example title" )}
)
)
)
);
Eval( // For each loop adds table_script to each data table named in dt_list
Eval Expr(
For Each( {value, index},
Expr( dt_list[index] << table_script )
)
)
);
Eval( // for loop alternative
eval expr(
for( i = 1, i <= N Items( dt_list ), i++,
expr( dt_list[i] << table_script )
)
)
);回覆:如何一次將腳本應用於多個資料表? (JMP 17)使用 For Each 是正確的想法。 當您開啟參考資料表時,您會獲得對它的引用,並且您會從多個文件匯入中獲得對其他資料表的引用清單(如果我沒記錯的話...)。 然後,您可以使用 For Each 循環該列表