cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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!!!!

Recommended Articles