尝试通过用户输入获得拟合模型。假设我想为用户提供合适的模型,因为我知道Y是什么,并且我想让他们进行gen reg。 所以我给他们。
Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
fit = dt << Fit Model(
Y( :height ),
Effects(),
Center Polynomials( 0 ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
);
很酷,很合身=模型对话框。 但这不是模态的,因此脚本可以继续运行。 同样,当他们推挤跑步时,合体性也被删除。
我真正想要的是让用户输入他们的资料,然后在报告生成后,我便继续。
我正在尝试做这样的事情,但是我没有运气。
while(
obj = current report()[OutlineBox(1)] << Get Scriptable Object();
!(char(obj) == "Fit Generalized[]" & try(obj[1] << Get Prediction Formula; 1, 0));
,
wait(.3);
);
一世真不需要使用所有选项重建整个UI,尤其是因为效果并不能直接放入。
回复:尝试通过用户输入获得拟合模型。我可以做这样的事情,但是我觉得有上千种方法可以解决这个问题,并且我确实希望有更强大的功能。
while(
obj = current report()[OutlineBox(1)] << Get Scriptable Object();
!(char(obj) == "Fit Generalized[]");
,
wait(.3);
);
btn_go_real = report(obj)[Buttonbox(1)];
report(obj)[1] << Append(Buttonbox("MyGo",
<<SET function=""></SET>回复:尝试通过用户输入获得拟合模型。这有什么帮助吗?这是一个模式窗口,您可以捕获输出显示树。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
nw = New Window( "example",
<<MODAL></MODAL>
回复:尝试通过用户输入获得拟合模型。并非如此,因为有第二个窗口
回复:尝试通过用户输入获得拟合模型。我之前曾使用过这种方法:
Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
fit = dt << Fit Model(
Y( :height ),
Effects(),
Center Polynomials( 0 ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
);
// The 'Run' button
runButton = Report(fit)[ButtonBox(9)];
// Append to the in-built action of the button
runButton << setScript(doSomething);
// The 'Terms' shown in 'dt2' reflect the user selections made in teh launch dialog
doSomething =
Expr(
Beep();
fit2 = fit << run;
dt2 = Report(fit2)[tableBox(5)] << makeCombinedDataTable;
dt2 << setName("Parameter Estimates")
);回复:尝试通过用户输入获得拟合模型。 @vince_faller , @ian_jmp 击败我。实际上,我的脚本使用了2个功能``保持对话框打开'',然后Ian的技巧是将脚本添加到他几年前(2018年8月21日附近)提供的运行按钮中。我的doSomething将模型保存到数据表中。
借此机会再次感谢Ian的有用技巧和“保持对话框打开”(Ian也使用了)。我实际上剪切并粘贴了他的代码并进行了修改!
Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
fit = dt << Fit Model(
Y( :height ),
Effects(),
Center Polynomials( 0 ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
Keep Dialog Open(1)
);
// Define a sample script
doSomething =
Expr(
Beep();
// For( i = 1, i <= N Table(), i++,
// Print( i, Data Table( i ) << getName )
// );
fit << Save to Data Table;
snames = dt << Get Table Script Names();
s = dt << get script( snames[N Items( snames )] );
Show( s );
);
// Assign the sample script to the button (JMP seems to prepend to the script that's already there?)
Report( fit )[Button Box( 9 )] << setScript( doSomething );
回复:尝试通过用户输入获得拟合模型。谢谢 @ian_jmp 和 @ gzmorgan0 ,我以大家所说的话为基础,基本上只做了两次,因为我真的希望我的doSomething在Gen Reg平台中按Go后可以做一些事情。 我还对它们进行了功能化,以确保此方法不会破坏局部变量。
如果我想让我的“ My_Gen_Reg”函数从“ doSomething”返回值,我将无法解决另一个问题。同样,尝试不使用全局变量或此处。
*编辑*,我有一个权宜之计,似乎可行。 我仍然不喜欢它的工作方式。 绝对比重新创建UI更好。
Names default to here(1);
my_Gen_Reg = Function({dt},
{fit, pf_get},
fit = dt << Fit Model(
Y( :height ),
Effects(),
Center Polynomials( 0 ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
//Keep Dialog Open(1)
);
Report( fit )[Button Box( 9 )] << Set Function(
Function({self},
{fit_self, fit2},
fit_self = ((self << Top Parent)[OutlineBox(1)]<<GET scriptable="" object=""></GET>