question about how to update an item in a field in batch mode

Sarah Reichelt sarah.reichelt at gmail.com
Mon Jan 21 15:20:15 EST 2008


On Jan 22, 2008 3:46 AM, Peter Alcibiades <palcibiades-first at yahoo.co.uk> wrote:
> There is a sales file with a varying number of lines, tab delimited.
>
> Each line records one transaction, the sale of one product.  These lines
> accumulate throughout the day.
>
> At the end of the day, I want to take (for instance) item 1 & tab & item 2 &
> tab, and use this to look up the line in the stock list that corresponds to
> that sale.  Then item 5 of that line in the stock list, which is the stock
> level, should be decremented by 1 to show one of these items has been sold.

Not tested, but should work fine, assuming that your sales file has
been loaded into a variable called tSalesData, and the stock file has
been loaded into tStockData:

set the itemDelimiter to tab
repeat for each line L in tSalesData
   get lineOffset(item 1 to 2 of L, tStockData)
   if it > 0 then subtract 1 from item 5 of line it of tStockData
end repeat

HTH,
Sarah



More information about the use-livecode mailing list