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
Jackie_
Level VI

Remove "" from the list

Hi @txnelson ,

I am trying to remove quotation mark "" from the list. 

The sitenum should have following results = {1, 2} no quotation mark. Any suggestions?

 

new window("", modal,
		ht = checkbox({"1","2"}),
		
			Buttonbox("Ok",
				get = ht << get selected();
				
			)
		);
	
sitenum ={};

Insert Into( sitenum, get);
	

 

4 REPLIES 4

Re: Remove "" from the list

Does this do what you need?

 

new window("", modal,
		ht = checkbox({"1","2"}),
		
			Buttonbox("Ok",
				get = ht << get selected();
				
			)
		);
	
sitenum ={};

for(i=1,i<=nitems(get),i++,
	get[i]=num(get[i])
);



Insert Into( sitenum, get);
jthi
Super User

Re: Remove "" from the list

If you have JMP16 and can be sure that the options will be numeric (which will be converted to strings), you could use Transform Each

 

Names Default To Here(1);

New Window("test",	<< modal,
	ht = Check Box({"1", "2"}), 
		
	Button Box("Ok",
		get = ht << get selected();
	)
);

sitenum = Transform Each({str}, get, Num(str));	

In general looping over the get list while converting the strings to numeric using Num() and adding them to a list in some way should work.

-Jarmo
Georg
Level VII

Re: Remove "" from the list

In these cases (if different values are needed for display and internal processing) I like to use associative array like you can see in the below example.

Names Default To Here( 1 );

site_aa = Associative Array( {{"Site 1", 1}, {"Site 2", 2}} );

New Window( "test",
	<<modal,
	ht = Check Box( site_aa << get keys ), 
		
	Button Box( "Ok", get = ht << get selected() )
);

site_lst = {};
For Each( {value}, get, Insert Into( site_lst, site_aa[value] ) );
Show( site_lst );
Georg
Byron_JMP
Staff

Re: Remove "" from the list

and yet another solution.

In this case, I don't get rid of the quotes, I just use the list item as a number rather than a string.

new window("", modal,
		ht = checkbox({"1","2"}),
		
			Buttonbox("Ok",
				get = ht << get selected();
				
			)
		);
	
sitenum ={};

Insert Into( sitenum, get);
print(sitenum);

site=num(sitenum[1]);
print(site);
JMP Systems Engineer, Health and Life Sciences (Pharma)