Name, Loyalty Card, Wax Treatment, EyeBrow treatment, email
Jane, 1,2,1, jane@email.com
Denise, 0,1,2, Denise@email.com
Jane, 1,1,0, jane@email.com
Now, I start with field one that has all the lines in it. I then copy each line into a variable and check whether the email address is already in field two. If not, I just pop it in field two.
If I find there's already a record, I add up all the fields, then update the line. So in the example above, I'd end up with :
Jane, 2,3,1, jane@email.com
Denise, 0,1,2, Denise@email.com
As it's going through each line, I'm incrementing a counter and displaying the current line in another label. Thing is, as it's getting big, it seems to freeze, but if I leave it long enough, it does finish and then update the total.
For example, if I just do 5,000 records, it gets to 1813 and then stops. I come back ten minutes later and it's updated to 5,000 and finished.
So, a) Why does it pause output but actually finish (apparently) correctly?
b) Am I just a crap coder and this code should be waaaay more efficient?
My code is here for you to giggle at:
Code: Select all
on mouseUp
#put zero into field "lblProc"
#put zero into field "lblDupes"
repeat for each line tLine in field one
put the value of field "lblProc" + 1 into field "lblProc"
put item 11 of tLine into tEmail
if tEmail is empty then
put tLine & CR after fld "fldNoEmail"
end if
put lineoffset(tEmail, field two) into wLine
if wLine is not 0 then
put the value of field "lblDupes" + 1 into field "lblDupes"
put line wLine of field two into tProc
put line wLine field two & CR after field "fldDupetxt"
# Loyalty cards
put item seven of tLine into tCardOne
put item seven of tProc into tCardTwo
put tCardOne + tCardTwo into tTotal
put tTotal into item seven of tProc
# End Loyalty cards
# Browsin
put item 9 of tLine into tBrowOne
put item 9 of tProc into tBrowTwo
put tBrowOne + tBrowTwo into tBrowTotal
put tBrowTotal into item 9 of tProc
# end Browsin
# Back to wow
put item 13 of tLine into tBackOne
put item 13 of tProc into tBackTwo
put tBackOne + tBackTwo into tBackTotal
put tBackTotal into item 13 of tProc
# end back to wow
# Eyebrow Tint
put item 14 of tLine into tTintOne
put item 14 of tProc into tTintTwo
put tTintOne + tTintTwo into tTintTotal
put tTintTotal into item 14 of tProc
# end eyebrow Tint
# EyeLash Tint
put item 15 of tLine into tLashOne
put item 15 of tProc into tLashTwo
put tLashOne + tLashTwo into tLashTotal
put tLashTotal into item 15 of tProc
# end eyelash tint
# FLC
put item 16 of tLine into tFLCOne
put item 16 of tProc into tFLCTwo
put tFLCOne + tFLCTwo into tFLCTotal
put tFLCTotal into item 16 of tProc
# end FLC
# EyeDo
put item 18 of tLine into tEyeOne
put item 18 of tProc into tEyeTwo
put tEyeOne + tEyeTwo into tEyeTotal
put tEyeTotal into item 18 of tProc
# end eyedo
# WaxLash
put item 22 of tLine into tWLashOne
put item 22 of tProc into tWLashTwo
put tWLashOne + tWLashTwo into tWLashTotal
put tWLashTotal into item 22 of tProc
# end WaxLash
# wax Treat
put item 23 of tLine into tWaxTreatOne
put item 23 of tProc into tWaxTreatTwo
put tWaxTreatOne + tWaxTreatTwo into tWaxTreatTotal
put tWaxTreatTotal into item 23 of tProc
# end wax treat
# Wow Brow
put item 24 of tLine into tWowOne
put item 24 of tProc into tWowTwo
put tWowOne + tWowTwo into tWowTotal
put tWowTotal into item 24 of tProc
# end Wow Brow
put tProc into line wLine of field two
else put tLine & CR after field two
end repeat
end mouseUp