One more gem from Jacqueline.
--- On Fri, 4/29/11, J. Landman Gay wrote:
From: J. Landman Gay
Subject: Re: Feedback: comparing content of two fields
To: "How to use LiveCode"
Date: Friday, April 29, 2011, 2:45 AM
On 4/28/11 10:04 PM, Ronald Zellner wrote:
> Had to remove the co
On 4/28/11 10:04 PM, Ronald Zellner wrote:
Had to remove the color change as you can't set that attribute- as Michael
predicted.
Actually you can. Another thing that slows down a script is using a
counter variable in a repeat loop. Sometimes you have to, but if
possible use the "repeat for
OK, slight modification of Peter's script:
on mouseUp
local allEntries, ruralEntries, theStart
put the seconds into theStart -- used to check the timing
put fld "All" into allEntries
put fld "Rural" into ruralEntries
set the itemDelimiter to tab
repeat with x = 1 to the nu
In the past, I've dealt with this situation by writing the changed data out
to another variable within the repeat loop, so:
repeat for each line myLine in theLines
if dataNeedsChanging then
end if
write myLine after theNewVariable
end repeat
put theNewVariable into theLines
I'm guessi
Hello Bob,
--Earlier Scott posted:
> on mouseUp
> set the itemDelimiter to tab
> put field "All" into tBigData -- use this to compare with field "Rural" data
> put tBigData into tBigData2 -- we will change this data as matches are found
> put field "Rural" into tSmallData
> --
This is why
It is absolutely faster. It was explained to me some time ago why. I think it
still applies, although I have not tried to test it.
It is because the engine works directly on the memory used for the object (or
something like that). The problem is, the engine parses the memory and creates
a list
> Be careful with repeat for each. You cannot change the content of the object
> or block you are repeating through. "Unexpected results" is an
> understatement. You need to work with a copy, making sure you don't add or
> remove the each element (each word, each line etc.) else you get out
Be careful with repeat for each. You cannot change the content of the object or
block you are repeating through. "Unexpected results" is an understatement. You
need to work with a copy, making sure you don't add or remove the each element
(each word, each line etc.) else you get out of sync.
B
;output_fld" to "red"
end if
end repeat
end mouseUp
--- On Thu, 4/28/11, Peter Brigham MD wrote:
From: Peter Brigham MD
Subject: Re: comparing content of two fields
To: "How to use LiveCode"
Date: Thursday, April 28, 2011, 7:41 AM
On Apr 27, 2011, at 11:55 PM,
On Apr 27, 2011, at 11:55 PM, Ronald Zellner wrote:
> I have two data fields that have multiple tabbed columns,
> I want to determine which items in the main field (1247 lines) also appear
> in the second field (436 lines).
>
> Using this code to compare line by line:
>
> on mouseUp
>
> se
Hello Ron,
Like Joe said, putting everything into a variable so you don't have to touch
the field as often is the first and biggest step to speeding things up. With
large lists, using the "repeat for each" structure may be faster. Her is an
example (untested off the cuff) Watch for line wraps.
Hi Ronald,
You can speed things up immeasurably by put the content of the fields into
variables and then make your comparisons between the vars. This is a universal
truth. Always work with vars; not fields.
HTH,
Joe Lewis Wilkins
Architect & Director of Product Development for GSI
O
I have two data fields that have multiple tabbed columns,
I want to determine which items in the main field (1247 lines) also appear in
the second field (436 lines).
Using this code to compare line by line:
on mouseUp
set the itemDelimiter to tab
repeat with x = 1 to the number of line
13 matches
Mail list logo