jmp 腳本中的物件引用JMP 社群您好,
我有一個關於 jmp 腳本中物件引用的問題。下面的程式碼運行 (JMP pro 17.2),但過程篩選會在不同的視窗中彈出,而不是在 Make_Win 函數中彈出,按鈕也放置在該視窗中。我知道如果我複製貼上
PS = dt << 過程篩選(...); V 列錶框內的部分然後行為變得如預期,但隨後程式碼變得不太可讀並且更混亂。
有沒有辦法在其他地方定義PS並且僅在函數內包含其引用(如下例所示),或者如何使下面的程式碼按預期工作。
Cols = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1", "PNP4", "NPN3", "IVP2", "NPN4", "SIT1", "INM1", "INM2",
"VPM1", "VPM2"};
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
PS = dt << Process Screening(
Y( Eval(Cols)),
Control Chart Type( "Indiv and MR" ),
Minimum Process Length( 1 ),
Use Medians instead of Means( 1 ),
Show tests( 0 ),
Test 1( 0 ),
Cp( 1 ),
Spec Limits( 1 ),
);
Make_Win = Expr(
New Window( "ProcessScreening",
Vlist_box = V List Box(
PS,
MyButton = Button Box( "SelectedRows", SendRows ),
),
),
);
SendRows = Expr(
print_cols = Report( PS )[Table Box( 1 )][String Col Box( 1 )] << getselectedrows();
Print( Report( PS )[Table Box( 1 )][String Col Box( 1 )][print_cols] );
);
Make_Win();謝謝,
JNS
自動化和腳本編寫回覆:jmp 腳本中的物件引用您想要使用 platform(...) 函數。
Scripting Index is in the Help menu腳本索引位於「說明」功能表中
當平台啟動時,如果是在新視窗構造中建立的,則它將自身附加到新視窗;如果是在顯示框構造中建立的,則它將附加到顯示框。否則它會建立一個新視窗。 platform() 函數傳回根顯示框而不將其附加到任何東西。過去我還建議在 dt< 周圍使用 borderbox 包裝器
腳本索引範例會更有意義,如下所示:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p=Platform(
dt,
Bubble Plot(
X( :weight ),
Y( :age ),
Sizes( :height ),
Title Position( 0, 0 )
)
);
New Window( "Platform example",
H List Box(
Platform(
dt,
Bubble Plot(
X( :weight ),
Y( :height ),
Sizes( :age ),
Title Position( 0, 0 )
)
),
p
)
);
回覆:jmp 腳本中的物件引用執行此操作有許多不同的選項,這裡是一個
Names Default To Here(1);
Cols = {"NPN1", "PNP1", "PNP2", "NPN2", "PNP3", "IVP1", "PNP4", "NPN3", "IVP2", "NPN4", "SIT1", "INM1", "INM2",
"VPM1", "VPM2"};
dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");
ps_collector = V List Box(
PS = dt << Process Screening(
Y(Eval(Cols)),
Control Chart Type("Indiv and MR"),
Minimum Process Length(1),
Use Medians instead of Means(1),
Show tests(0),
Test 1(0),
Cp(1),
Spec Limits(1),
)
);
SendRows = Expr(
print_cols = Report(PS)[Table Box(1)][String Col Box(1)] << getselectedrows();
Print(Report(PS)[Table Box(1)][String Col Box(1)][print_cols]);
);
nw = New Window("ProcessScreening", Vlist_box = V List Box(ps_collector),
Button Box("OK", sendrows);
);