Subscribe Bookmark RSS Feed

Subsetting a table containing a column of names

Apologies if this is a trivial question, but I've been staring it for a while and getting nowhere. The problem is illustrated in the following snippet of JSL script:



I want to select those rows of table "NameTable" which contain only the names that appear in Check_List (so in this trivial example I need to select the rows whose values are one of "AAA", "BBB" or "EEE"). I know I could do this very easily with a FOR loop, but I feel I ought to be able to do it more elegantly than that, probably using the "contains" function and/or an associative array, but I can't get my head around how to set it up. Can anybody show me how it could be done?

Many thanks
2 REPLIES
chungwei

Staff

Joined:

Jun 23, 2011

NameTable<
Of course - simple. I got confused by trying to evaluate the contents of the "contains" function separately before putting it inside the "select where" function - i.e. "show(contains(Check_List, :Names))" - and assuming that because that returns a single number as opposed to a list of numbers showing which rows to select, I must have got it wrong. If I'd actually tried it out inside the "select where" function I'd have found it at once.

Many thanks.