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
Agustin
Level IV

Trying to use Remove(source, {items})

I'm trying to remove 2 items from a list but I'm getting this error

 

"index must be number or list of numbers at row 1 in access or evaluation of 'List' , {/*###*/lst2}"

 

lst = As List((Associative Array( dt1:Name << get values ) << Get Keys))
lst2 = As List( {"NTC","PC"})
Remove( lst, {lst2})

lst = As List((Associative Array( dt1:Name << get values ) << Get Keys))
lst2 = As List( {"Pete","Clare"})
Remove( lst, lst2)

I've tried both there options and they both return an error. Where am I going wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Trying to use Remove(source, {items})

Error message is quite clear here, you need to have number or list of number which you use for deletion, not a list of strings

jthi_0-1654852474195.png

 

Without knowing more about what you are trying to do, you could for example use Filter Each or Associative Array

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

lst = Associative Array(dt:Name << get values);
lst2 = Associative Array({"KATIE", "BARBARA"});
show(Contains(lst, "KATIE"));
lst << Remove(lst2);
lst = lst << get keys;
show(Contains(lst, "KATIE"));

Work with Associative Arrays (jmp.com)

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Trying to use Remove(source, {items})

Error message is quite clear here, you need to have number or list of number which you use for deletion, not a list of strings

jthi_0-1654852474195.png

 

Without knowing more about what you are trying to do, you could for example use Filter Each or Associative Array

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

lst = Associative Array(dt:Name << get values);
lst2 = Associative Array({"KATIE", "BARBARA"});
show(Contains(lst, "KATIE"));
lst << Remove(lst2);
lst = lst << get keys;
show(Contains(lst, "KATIE"));

Work with Associative Arrays (jmp.com)

 

-Jarmo