將新腳本從表達式儲存到資料表您好...我希望能夠從包含列名的清單中在視窗中建立多個可變性圖表。我可以讓它實時成功運行(感謝其他 JMP 論壇帖子的幫助)。但我也想將腳本保存到數據表中,以便下次打開數據表時,用戶只需單擊“綠色三角形”即可生成相同的圖表視窗。我已經接近了,它正在將一些內容保存到數據表中,但不會在單擊綠色三角形時生成帶有圖表的視窗。如果我右鍵單擊綠色三角形並選擇“編輯”,我可以看到它不會產生帶有圖表的視窗的原因是整個腳本都在引號中。我不知道如何刪除引號。有什麼想法嗎?
首先,我建立字串(plotAllStandardExpr)以透過 for 循環中的一系列連接來建立新視窗。
第二行 Eval(Parse(plotAllStandardExpr)) 將成功建立包含所有圖表的視窗。
但是 Eval(Substitute(....) 行只是將引用的字串保存到資料表中。我在 Substitute 函數中嘗試了 Eval(Parse(plotAllStandardExpr)),但沒有起作用。
Current Data Table(dtSplit_copy);
plotAllStandardExpr = "New Window(\!"Var Charts: All\!", V List Box(";
for(i = 1, i <= NItems(plotcols), i++,
plotAllStandardExpr = plotAllStandardExpr || "Variability Chart(
Y(" || plotcolsString[i] || "),
X( :Split, :Voltage, :tst_temp ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ));"
);
plotAllStandardExpr = plotAllStandardExpr ||"))";
Eval(Parse(plotAllStandardExpr));
Eval(Substitute(Expr(dtSplit_copy << New Script("All Var charts", xxxx)),
Expr(xxxx), Eval(plotAllStandardExpr)));
自動化和腳本資料混合與清理品質與工藝工程回复:將新腳本從表達式保存到數據表您需要使用 Parse() 刪除引號(不需要 Eval() 因為您想要表達式)。 下面是幾個選項
Names Default To Here(1);
dt = New Table("");
plotcolsString = {"height", "weight"};
plotAllStandardExpr = "New Window(\!"Var Charts: All\!", V List Box(";
For(i = 1, i <= N Items(plotcolsString), i++,
plotAllStandardExpr = plotAllStandardExpr || "Variability Chart(
Y(" || plotcolsString[i]
||
"),
X( :Split, :Voltage, :tst_temp ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ))
,"
);
plotAllStandardExpr = plotAllStandardExpr || "))";
Parse(plotAllStandardExpr);
Eval(EvalExpr(dt << New Script("all var charts", Expr(Parse(plotAllStandardExpr)))));
Eval(Substitute(
Expr(dt << New Script("All Var charts2", _script_)),
Expr(_script_), Parse(plotAllStandardExpr))
);

回复:將新腳本從表達式保存到數據表非常感謝。 兩種選擇都像宣傳的那樣有效!