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);
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);
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.
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 );
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);