你好
我是JMP脚本的经验不足的用户,需要如何添加新列的帮助,新列的数据将由用户定义并具有固定编号。意思是,每当我运行代码时,它都应该询问感兴趣的数字以填充到新列中。实际上,我有不同的数量和(填入新列)需要填写不同的数据表的不同任务。
如果我理解您的要求,听起来您既要同时作为值的用户,又要在公式中使用该值。 这可能有助于您入门:
//Make sure variables names defined here do not interfere with other scripts
Names default to here(1);
//start by opening a data table. Instead of this, you could just use
// dt = current data table();
dt = Open("$Sample_Data/iris.jmp");
dt << New Script(
"New Column",
//Open a new window which...
win = New Window ( "Create a column",
Show Menu( 0 ),
Show Toolbars( 0 ),
v list box(
Text Box( "Add a new column."),
Spacer box( Size( 20,20 ) ),
//asks the user for a column name...
Text Box("Enter a column name"),
tebName = Text Edit Box( "Column 1", Set Width( 200 ) ),
Spacer box( Size( 10,10 ) ),
//and a value...
Text Box("Enter a value in the column"),
nebValue = Number Edit Box( 0 ),
Spacer box( Size( 10,10 ) ),
H list box(
//and includeds a button with a script that creates the column...
Button Box( "Create A Column",
//Use Eval, Eval Expr, and Expr to put the RESULT of the expression "nebValue << Get" into the formula
//instead of the expression itself
Names default to here( 1 );
dt = current data table();
Eval( Eval Expr(
dt << New Column( tebName << Get Text, Numeric, "Continuous", Format("Best", 12), Formula( Expr( nebValue << Get ) ) )
) )
),
//and another button to close the window.
Button Box( "Close",
win << Close Window
)
)
)
);
);你好
感谢您的帮助,它主要帮助我完成脚本。实际上,我的任务和任务是需要拉出不包含完整数据的csv文件,并使其包含可变数据,这取决于我的项目。似乎您的代码对我有更大的帮助,所以现在我需要考虑如何从初始阶段开始合并,直到仅使用单个代码就可以得到图形。也许可以做到,并且还需要该社区小组中的一些专家提供建议。非常感谢你。