Tate83
Tate83

Reputation: 274

Repeat in array with subselection

I have an array with

100    foo    data  
200    bar    data
300    foo    data

Is there a way to do something like this?

repeat for each key myKey in myArray where item 2 is "foo"

So all rows in the array with item 2 = "bar" are not considered and my result would be row 1 and 3?

Upvotes: 0

Views: 83

Answers (1)

dunbarx
dunbarx

Reputation: 756

Not the way you have written it. If you are in array mode, you must stay in array mode. If in the clear, stay in the clear. You have a mixed bag.

I would do this fully in the clear. After deconstructing the array variable with the "combine" command, and setting the itemDel to tab (?):

repeat for each line tLine in newClearVar
  if item 2 of tLine = "foo" then...

That sort of thing. You can then always reconstruct the array again with the "split" command.

Craig Newman

Upvotes: 1

Related Questions