question about how to update an item in a field in batch mode
Peter Alcibiades
palcibiades-first at yahoo.co.uk
Tue Jan 22 14:32:04 EST 2008
Trying Sarah's suggestion first, but cannot seem to make it work:
on mouseUp
set the itemDelimiter to tab
repeat for each line L in field "tSales"
get lineOffset(item 1 to 2 of L, "tStock")
if it > 0 then subtract 1 from item 5 of line it of field "tStock"
end repeat
end mouseUp
It does nothing. The reason being that variable it is always 0, though there
should be a match for items 1 to 2. If I make it just match on item 1, same
thing.
Then if I take out the condition, something even stranger happens. It writes
as many zeros as there are items doing the match before item 1 of line 1 of
tStoc. (there are two items which should match in the sample file, and for
some reason the only one it finds is the second one!)
But I can't understand why it doesn't work. It doesn't seem to violate the
rule about not changing a variable during repeat.
Seem to be making heavy weather out of this one. On to Jeanne's suggestion
now.
Peter
More information about the use-livecode
mailing list