It takes about 9 seconds to run through a table of data about 150 lines. This is unaceptable, because it is part of a "behind the scenes" refresh and the user will experience an unexpected freeze.
If a larger data sample is in the table, obviously, the problem gets much worse.
Code: Select all
on mouseUp
local NumLines, LineCount,Temp,Temp1
set itemdelimiter to tab
set the twelveHourTime to false
set the useSystemDate to true
put number of lines of field "Table 1" into NumLines
put the time into Temp1
convert Temp1 to seconds
put 0 into LineCount
repeat for NumLines
put 1 + LineCount into LineCount
if item 13 of line LineCount of Field "Table 1" > 0 then
if item 13 of line LineCount of Field "Table 1" > Temp1 then
set the backgroundColor of line LineCount of field "Table 1" to "yellow"
else
set the backgroundColor of line LineCount of field "Table 1" to "red"
end if
else
put empty into item 13 of line LineCount of Field "Table 1"
set the backgroundColor of line LineCount of field "Table 1" to empty
end if
-- sort lines of Field "Table 1" descending numeric by item 13 of each -- this makes no visible difference
end repeat
end mouseUp