cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
LBrian
Level III

Make error message

Hi, All.

 

I want to make an error message 'No item' window.

I made a script. but, it has not worked.

 

Please check my script where is wrong.

Names Default To Here( 1 );
dt = Open( "$Sample_Data/Blood pressure.jmp" );
dt<< show window( 0 );

win = New Window( "Select Item(s) for drawing the Histogram",
		<<Modal,
		Text Box( "Item List" ),
		H List Box(
			allcols = Col List Box( dt, all ),
			Lineup Box(
				2,
				V List Box(
					bbAdd = Button Box( "Add", xcols << append( allcols << get selected ) ),
					bbRemove = Button Box( "Remove", xcols << remove selected )

				),
				xcols = Col List Box( "Numeric", <<Modeling Type( {"Continuous"} ), min items( 1 ) ),

			),
			V List Box(
				bbOK = Button Box( "OK",
					xvar = (xcols << Get Items);
					str = "";
					
					show(xvar);
					
					if(xvar == "{}",
					Throw("No item")
					);					
					For( i = 1, i <= N Items( xvar ), i++,
						str = str || "Continuous Distribution(Column(:Name(\!"" || xvar[i] || "\!"))),"
					);
					Eval( Parse( "dt << Distribution(stack(1)," || str || ");" ) );
					win << Close Window;
					
	
				),
				bbCancel = Button Box( "Cancel", Throw() )
			)
		)
	);

Thanks.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tom_abramov
Level V

Re: Make error message

Hi,

add error window message in case of zero column added:

Names Default To Here( 1 );
dt = Open( "$Sample_Data/Blood pressure.jmp" );
dt<< show window( 0 );

win = New Window( "Select Item(s) for drawing the Histogram",
		//<<Modal,
		Text Box( "Item List" ),
		H List Box(
			allcols = Col List Box( dt, all ),
			Lineup Box(
				2,
				V List Box(
					bbAdd = Button Box( "Add", xcols << append( allcols << get selected ) ),
					bbRemove = Button Box( "Remove", xcols << remove selected )

				),
				xcols = Col List Box( "Numeric", <<Modeling Type( {"Continuous"} ), min items( 1 ) ),

			),
			V List Box(
				bbOK = Button Box( "OK",
					xvar = (xcols << Get Items);
					
					str = "";
					
					show(xvar);
					
					if(NItems(xvar) == 0,
					ErrWin = New Window("Error",<<modal, Text Box( "\!NPlease add columns\!N\!N" ))
					,//else					
					For( i = 1, i <= N Items( xvar ), i++,
						str = str || "Continuous Distribution(Column(:Name(\!"" || xvar[i] || "\!"))),"
					);
					Eval( Parse( "dt << Distribution(stack(1)," || str || ");" ) );
					win << Close Window;
					);//end of if
	
				),
				bbCancel = Button Box( "Cancel", Throw() )
			)
		)
	);

View solution in original post

2 REPLIES 2
tom_abramov
Level V

Re: Make error message

Hi,

add error window message in case of zero column added:

Names Default To Here( 1 );
dt = Open( "$Sample_Data/Blood pressure.jmp" );
dt<< show window( 0 );

win = New Window( "Select Item(s) for drawing the Histogram",
		//<<Modal,
		Text Box( "Item List" ),
		H List Box(
			allcols = Col List Box( dt, all ),
			Lineup Box(
				2,
				V List Box(
					bbAdd = Button Box( "Add", xcols << append( allcols << get selected ) ),
					bbRemove = Button Box( "Remove", xcols << remove selected )

				),
				xcols = Col List Box( "Numeric", <<Modeling Type( {"Continuous"} ), min items( 1 ) ),

			),
			V List Box(
				bbOK = Button Box( "OK",
					xvar = (xcols << Get Items);
					
					str = "";
					
					show(xvar);
					
					if(NItems(xvar) == 0,
					ErrWin = New Window("Error",<<modal, Text Box( "\!NPlease add columns\!N\!N" ))
					,//else					
					For( i = 1, i <= N Items( xvar ), i++,
						str = str || "Continuous Distribution(Column(:Name(\!"" || xvar[i] || "\!"))),"
					);
					Eval( Parse( "dt << Distribution(stack(1)," || str || ");" ) );
					win << Close Window;
					);//end of if
	
				),
				bbCancel = Button Box( "Cancel", Throw() )
			)
		)
	);
LBrian
Level III

Re: Make error message

Thank you very much!!!!