I have a library of utility JSL functions that I rely on to perform common tasks. Each Friday I will publish one of them; starting today.
Unique List Items
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Unique List Items = Function( {lst}, {Default Local}, tmp = Associative Array(); Insert Into( tmp, lst ); newlst = tmp << get keys; Return(newLst); ); // For example myList = {"A","A","A","B","C","B"}; newList = Unique List Items(myList); // newList contains {"A","B","C"} |
I use a similar function all the time. It’s really useful right before a “for” loop – to make sure you’re looping through exactly the set of parameters you’re really dealing with.
Good to hear. Thanks for your feedback Chad.