Thanks Craig,
It works now with a small addition:
put i & cr after temp
so the code is:
Code: Select all
on mouseUp
set itemDel to tab
put fld "a" into numbers
put fld "b" into falsetrue
answer falsetrue
repeat for each line i in falsetrue
if item 1 of i is in numbers then
-- if item 1 of i is among items of numbers then -- this works equally well
put "true" into item 2 of i
end if
put i & cr after temp
end repeat
put temp into falsetrue
put falsetrue into msg box
end mouseUp
dunbarx wrote:What does "counter" do?
It's not needed here in this form of the repeat.
So now I have 2 questions that follow this:
1. Suppose that I have 1000 lines in field b and 300 numbers in field a. Is this method, of repeating/looping through each line the fastest one?
What could be other ways?
2. If I have now the new field b with these rows and columns that was put into variable falsetrue:
001 false
002 true
003 false
004 false
005 true
006 false
007 false
008 false
009 true
010 false
and a 3rd field c like this that was put into variable text:
001 false gasfgagag
002 false gsdgjdj
003 false xbxbxvb
004 false xcvbsdhs
005 false ghfjfgj
006 false shhsh
007 false fgjhfhjfgj
008 false sfgsgs
009 false dghsaf
010 false wytufdhj
What is the fastest way of replacing false with true in the lines of text variable that have the same numbers as true numbers in falsetrue?
Of course I could extract the numbers from falsetrue lines that have true and replace false with true in text variable in the same way as above.
But is there some faster, direct way, without that intermediary step?
Maybe merging falsetrue with text in some way and then deleting one of the number columns and the complete false column?
Or any other way?
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit