How about something like this:
put tList into list1
put tList into list2
put tList into list3
filter list1 with * item 1 of gCodes *
filter list2 with * item 2 of gCodes *
filter list3 with * item 3 of gCodes *
put list1 cr list2 cr list3 into outputList
-- Peter
Peter M. Brigham
Peter-
Saturday, July 20, 2013, 9:22:00 AM, you wrote:
How about something like this:
put tList into list1
put tList into list2
put tList into list3
filter list1 with * item 1 of gCodes *
filter list2 with * item 2 of gCodes *
filter list3 with * item 3 of gCodes *
put list1 cr
Thanks Peter. That would work fine for a fixed list, or the current 3
items, but if the list grows, I would have to edit the script. I ended up
using repeat for each, and since even the large list is less than 100
lines, it is done in a few milliseconds.
~Roger
On Jul 20, 2013 12:22 PM, Peter
global gCodes
put tList into tGood; put tList into tBad
put PPX,RRY,NNZ into gCodes
-- Keep lines that contain any item of gCodes
filter tGood with (* item 1 of gCodes *) or (* item 2 of gCodes
*) or (* item 3 of gCodes *)
filter tBad without (* item 1 of gCodes *) or (* item 2 of gCodes
Roger Eller wrote:
global gCodes
put tList into tGood; put tList into tBad
put PPX,RRY,NNZ into gCodes
-- Keep lines that contain any item of gCodes
filter tGood with (* item 1 of gCodes *) or (* item 2 of gCodes
*) or (* item 3 of gCodes *)
filter tBad without (* item 1 of gCodes *) or
Thanks Richard.
To give a better picture of the requirements, the gCodes will be read from
a user editable preference file (.txt), so there could easily be 3 or more
(or less) items that have to be examined for each line of tList (a report
file).
At the moment, it works for the hard-coded 3
I'd be inclined to do this:
repeat for each line...
repeat for each item...
And check for contains as you are thinking. This goes through tList only once.
(I'm assuming that tList is large and gCodes is small.)
Other ideas:
I think filter does not use a real regex. If it does you can