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 脚本中的对象引用执行此操作有许多不同的选项,这里是一个
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);
);
回复: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
)
);