你好
我不是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文件,並使其包含可變數據,這取決於我的項目。似乎您的代碼對我有更大的幫助,所以現在我需要考慮如何從初始階段開始合併,直到僅使用單個代碼就可以得到圖形。也許可以做到,並且還需要該社區小組中的一些專家提供建議。非常感謝你。