In this script, in the last two functions when the number edit box is changed I'm using that value and its left or right sibling to calculate a new value. When I change the left box I can successfully find its right (next) sibling using << sib. When I change the right box, I cannot get to its previous (left) sibling using << prev sib.
Number edit box do support << sib but do not support << prev sib according to my JMP 14 log. Run attached script and change the number
boxes to test for yourself.
Am I using the right function? If yes, is there a way to work around this omission?
dt = New Table( "untitled 1",
Add Rows( 0 ),
Compress File When Saved( 1 ),
New Table Variable( "First", 1.5 ),
New Table Variable( "Second", 2.4 ),
New Table Variable( "Third", 0 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [] )
)
);
LB = lineup box(NCol(4),
Text box("Factor"),
Text box("Total"),
Text box("Metrology"),
Text box("Process"),
);
TableVariables = dt << Get Table Variable Names();
New window("Variation",
v list box(
LB = lineup box(NCol(4),
Text box("Factor"),
Text box("Total"),
Text box("Metrology"),
Text box("Process"),
),
Button Box( "Write Total",ApplyTotalButton)
)
);
for(i=1,i<=N items(TableVariables),i++,
LB << Append(text Box(TableVariables[i]));
LB << Append(number edit Box(num(dt<<get table variable(TableVariables[i])), << set Function(RMSEFunction)));
LB << Append(number edit Box(0, << set Function(SMEFunction)));
LB << Append(Text Box("0"));
);
ApplyTotalButton = Expr(
//When the button is clicked, get the values from the left column of number edit boxes and write to the table variables.
RMSEVals = Current Window() << xpath( "//NumberEditBox/text()" );
For( i = 1, i <= N Items( RMSEVals ) / 2, i++,
dt << Set Table Variable( TableVariables[i], Num( RMSEVals[(2 * i) - 1] ) )
);
);
RMSEFunction = Function( {this},
//When value in this Number Edit Box is changed, get the value from this box and the one to the right and add the result and put it in the text box on the far right.
RMSE = num( this << Get text() );
SME = num(( this << sib) << Get text() );
(( this << sib) << sib) << set text(char(sqrt(num(RMSE)^2-num(SME)^2)));
//Variable = (this << prev sib) << get text();
//dt << Set Table Variable( Variable, num( this << Get text() ));
);
SMEFunction = Function( {this},
//When value in this Number Edit Box is changed, get the value from this box and the one to the left and add the result and put it in the text box on the far right.
RMSE = num((this << prev sib) << Get text());
SME = num(this << Get text( this << sib()));
( this << sib) << set text(char(sqrt(num(RMSE)^2-num(SME)^2)));
);