cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
LBrian
Level III

How to use contains() correctly?

Hi, All

 

I wanna use contains(),

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

colNamesList = dt << get column names( continuous );

Input = New Window( "example", << modal(),
	new1 = hlistbox(
	Text Box( "Test name :" ),
	Para_Num_teb = Text Edit Box( "", <<set width( 200 ) )
	),
		text box("Click OK"),
		Button Box( "OK", 
		Para_Num = Para_Num_teb << get text();
		),
);

if (!contains(colNamesList, Para_Num),
	Throw("Fail ")
);

however,

Fail message occurs everytime on this script which i made.

 

Could you give me any advice?

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to use contains() correctly?

The issue you are having is that you are retrieving a character string variable from your Button Box, but your list of column names are expressions

para_num = "zippy";

colnameslist = {BP 8M, BP 12M, BP 6M, BP 8W, BP 12W, BP 6W, BP 8F, BP 12F, BP 6F};

 

If you just specify to have the colNamesList returned as strings, your code will work

colNamesList = dt << get column names( continuous, string );

 

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: How to use contains() correctly?

The issue you are having is that you are retrieving a character string variable from your Button Box, but your list of column names are expressions

para_num = "zippy";

colnameslist = {BP 8M, BP 12M, BP 6M, BP 8W, BP 12W, BP 6W, BP 8F, BP 12F, BP 6F};

 

If you just specify to have the colNamesList returned as strings, your code will work

colNamesList = dt << get column names( continuous, string );

 

 

Jim
LBrian
Level III

Re: How to use contains() correctly?

Thank you very much Doctor!!!

Recommended Articles