also making apologize for being so much delayed in providing my result. my sickness due to low blood pressure sent me to bed rest for couple of months out of my town with my parents. by the grace of Almighty I'm recovered and back to my work
hello bwmilby, your code given me almost my expected output; the only thing that lacks your code is, it just removes the lines containing only one tKey, doesn't repeat for the rest tList.bwmilby wrote: ↑Tue Mar 13, 2018 11:10 pmYou need a repeat loop before the filter. Loop through each line and record the text before the @. Check to see if the current line text is in the list. If so, exit the loop. Use the found text to filter the list.
I tested the below on the sample that you provided and it seemed to give the expected result.
########CODE to copy and paste with you mouse#######
on mouseUp
local tList, tKey, tKeys
set the itemDel to "@"
put the text of field "Source" into tList
repeat for each line tLine in tList
put (item 1 of tLine) & "@" into tKey
if lineOffset(tKey, tKeys) > 0 then exit repeat
put cr & tKey after tKeys
end repeat
set the text of field "Key" to tKey
filter tList without (tKey & "*")
set the text of field "Destination" to tList
end mouseUp
#####END OF CODE generated by this livecode app: http://tinyurl.com/j8xf3xq with livecode 9.0.0-dp-11#####
Edit 1: Add code
Edit 2: Add image
Edit 3: The code does not ensure that there was a duplicate line, so if none were found it would remove the last line of the file. That would be an easy thing to add though.
HTSOT.JPG
here's the sample list that I wanna filter out:
using your code, I get the following result:matsas007@server1:info3143
phamminhman1@server5:info3605
devilcry95@server4:info8051
boysatthu98@server1:info316515
devilcry95@server4:info36054
thedevilcry95@server8:info50289
phamminhman1@server1:info4441
devilcry537@server7:info3656
xuanphungbd@server3:info51343
devilcry95@server2:info78514
44boysatthu98@server5:info96315
tuananhhau@server1:info53476
boysatthu98@server6:info316515
but the actual result I want is:matsas007@server1:info3143
phamminhman1@server5:info3605
boysatthu98@server1:info316515
thedevilcry95@server8:info50289
phamminhman1@server1:info4441
devilcry537@server7:info3656
xuanphungbd@server3:info51343
44boysatthu98@server5:info96315
tuananhhau@server1:info53476
boysatthu98@server6:info316515
I've tried in may ways to repeat the function, but failed to make it in proper way. So either you or anyone can fulfill the quest would be so much appreciated. Loving livecode (lifecode for me as it gives life to coding)matsas007@server1:info3143
thedevilcry95@server8:info50289
devilcry537@server7:info3656
xuanphungbd@server3:info51343
44boysatthu98@server5:info96315
tuananhhau@server1:info53476