this is what ive done so far.
Code: Select all
on mouseUp
initialise
read_in MyText
display_answer buyerinfo, buyername, buyersurname, numbertickets
findingsales arraym
end mouseUp
on initialise
put "" into MyText
put "" into buyerinfo
put "" into buyername
put "" into buyersurname
put 0 into numbertickets
put 0 into total
end initialise
on read_in @MyText
Answer file "Please choose a file to read into your LiveCode stack"
if the result is not "cancel" then
put it into MyText
put url("file:" & MyText) into MyText
end if
end read_in
on display_answer MyText, @buyerinfo, @buyername, @buyersurname, @numbertickets, @total
local loop
repeat with loop = 1 to number of lines of MyText
put line loop of MyText into buyerinfo
split buyerinfo by comma
put buyerinfo[1] into buyername[loop]
put buyerinfo[2] into buyersurname[loop]
put buyerinfo[3] into numbertickets[loop]
put buyername[loop] & tab & buyersurname[loop] & tab & numbertickets[loop] into line loop of field "output2"
end repeat
local tickets, totalamount, maxtickets
put 0 into tickets
put 10 into maxtickets
put numbetickets[1] into totalamount
repeat with loop = 2 to number of lines of MyText
if numbertickets[loop] > totalamount then
put numbertickets[loop] into totalamount
put loop into tickets
end if
end repeat
set numberformat to "0"
end display_answer
on findingsales
local scounter, wcounter
put 0 into scounter
put 0 into wcounter
repeat with loop = 1 to number of lines of MyText
if arraym[loop] = "S"
THEN put +1 into scounter
then arraym[loop] = "w"
put +1 into wcounter
end if
end repeat
end findingsales