I executed the same thing but I am getting an error and also in the data table the column name is being displayed instead of the values.
Names Default To Here( 1 );
Error = expr(New Window("JMP ALERT" , <<Modal, alert=Textbox("Please select the required fields."), alert<< set font size(11), <<set font name("Calibri"), ButtonBox("OK")));
Openwindow = expr(Distribution << open window);
dt = Open( "C:\Users\vgarlap1\Documents\JMP Application\2016_37742-Dist.XLS_Length_n (2).jmp", invisible(1) );
Distribution = New Window( "Distribution Fit",
<< modal(),
<<On Close( Close( dt, nosave )),
V List Box(
Spacer Box(Size(2, 4)),
Title = Text Box("AFIS Length Distribution Fit"),
Title1 = Text Box("(Customized procedure for Ln)"),
Title << set font size(12), << set width(240), <<set font name("Calibri") ;
Title1 << set font size(11), << set width(240);
Spacer Box(Size(4, 6)),
H List Box(
Panel Box( "Column List",
ColListData = Col List Box(
all,
width( 250 ),
maxSelected( 1 )
)
),
V list box(
Panel Box( "Column Selection",
Lineup Box( N Col( 2 ),
Button box("X Column", << Set Function(Function({this},(this << sib) << Set Items((ColListData << Get Selected));))),
colListX = ColListBox(dt, Min Items(1), Max Items(1), N Lines(2)),
Button box("Y Column", << Set Function(Function({this},(this << sib) << Set Items((ColListData << Get Selected));))),
colListY = ColListBox(dt, Min Items(1), Max Items(1), N Lines(2)),
Button box("BY Column", << Set Function(Function({this},(this << sib) << Set Items((ColListData << Get Selected));))),
colListBy = ColListBox(dt, Min Items(1), Max Items(1), N Lines(2))
);
),
H List box(
Button box("Ok",
//<<On Close(nosave),
If(nitems(colListX << Get Items())<1 | nitems(colListY << Get Items())<1 ,
Error,
);
dt= currentdatatable();
icol = dt << Get Column Names();
Nrows = N Row (dt);
x_selection = colListX << get items;
y_selection = colListY << get items;
by_selection = colListBy << get items;
New Column( "Model",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
Parameter(
{p = 0.29, x0 = 15, m0 = 1.2, x1 = 30, m1 = 5},
p * (1 - Exp( -(Eval(x_selection)/ x0) ^ m0 )) + (1 - p) * (1
-Exp( -Eval(x_selection)/ x1) ^ m1 )
)
),
);
nlin = dt << Nonlinear(
SendToByGroup( Bygroup Default ),
Y(Eval(y_selection)),
X( :Model ),
Iteration Limit( 1000 ),
Unthreaded( 1 ),
QuasiNewton BFGS,
//Newton,
Finish,
By(Eval(by_selection)),
);
rnlin1 = Report( nlin[1] );
//colListX << Clear Selection,
//colListY << Clear Selection,
//colListBy << Clear Selection
),
ButtonBox("Cancel", Distribution<<CloseWindow),
ButtonBox("Remove",
colListX<<RemoveSelected;
colListY<<RemoveSelected;
colListBy<<RemoveSelected;
)
)
)
)
)
);