cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
lehaofeng
Level V

How to avoid error when using the row change handler?

go_down_expr = Expr(
	
	cur_row = (dt << get selected rows());
	If(
		N Items( cur_row ) == 0,
			New Window( "Alert", <<size( 300, 100 ), Border Box( top( 10 ), bottom( 10 ), Left( 10 ), Right( 10 ), Text Box( "No selection" ) ) ),
		N Items( Loc( crows > cur_row[1] ) ) == 0, dt << gotorow( crows[1] ),
		dt << go to row( crows[(Loc( crows > cur_row[1] ))[1]] )
	);
	
);

f = Function( {a = [1]}, 
	val_lst = dt[a, x5_col];
	dt2 << clear select();
	For Each( {value, index}, val_lst, If( Column( dt2, 1 )[index] != value, Column( dt2, 1 )[index] = value ) );
	Column( dt2, 1 ) << Delete Property( "Spec Limits" );
	cpk_show = Column( dt, "CPKvalue" )[a];
	cpko_show = Column( dt, "Cpk" )[a];
	ncb1 << set( cpko_show[1] );
	ncb2 << set( Round( cpk_show[1], 3 ) );
	Eval(
		Eval Expr(
			Column( dt2, 1 ) << Set Property(
				"Spec Limits",
				{LSL( Expr( LSL[a[1]] ) ), USL( Expr( USL[a[1]] ) ), Target( Expr( dt:Nominal[a[1]] ) ), Show Limits( 1 )}
			)
		)
	);
	For Each( {value, index}, dt[a, x5_col], Eval( Parse( "d" || Char( index ) || "<<set(" || Char( value ) || ")" ) ) );
	a = a[1];
	
	backup = dt2 << Distribution( invisible, Column( :y ), Fit Normal( Goodness of Fit( 1 ) ), Histograms Only ); 
	
	
	pvalue = Report( backup )["Goodness-of-Fit Test"][Number Col Box( "Prob<W" )][1];
	backup << close window;
	

	xmax = Report( obj2 )[axisbox( 1 )] << get max;
	xmin = Report( obj2 )[axisbox( 1 )] << get min;
	ymax = Report( obj2 )[axisbox( 2 )] << get max;
	ymin = Report( obj2 )[axisbox( 2 )] << get min;
	
	Report( obj2 )[axisbox( 2 )] << max(28);
	
	Report( obj2 )[framebox( 1 )] << append seg( ts1 = Text Seg( "" ) );
	ts1 << set location( xmax - (xmax - xmin) / 6, 25 );
	
	If( pvalue >= 0.05,
		ts1 << set text( "normal" );
		ts1 << Set Text Color( "dark Green" );
	,
		ts1 << set text( "non-normal" );
		ts1 << Set Text Color( "Red" );
	);

);

rs = dt << make row state handler( f );

Hi guys, I've got a problem: I've created a row handler function that automatically calculates normality when rows change, draws graphs, etc.; it uses a button box to control the action of moving to the next row, but when I click too fast, an error occurs indicating that  the loop was detected earlier. 

How to solve it?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to avoid error when using the row change handler?

If you are using button to move to next row, do you need row state handler?

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How to avoid error when using the row change handler?

If you are using button to move to next row, do you need row state handler?

-Jarmo
lehaofeng
Level V

Re: How to avoid error when using the row change handler?

Thanks! You're right. I was overthinking it.