Not displaying the correct way.
Posted: Fri Dec 09, 2016 2:34 pm
i have to make my code display in this format..
The most popular method of sales is XXXXX
The total money raised for charity is £XXXXX
But i am unsure how to do this as the help i was given did not format it in this way.
The most popular method of sales is XXXXX
The total money raised for charity is £XXXXX
But i am unsure how to do this as the help i was given did not format it in this way.
Code: Select all
on mouseUp
initialise
read_in MyText
display_answer buyerinfo, buyername, buyersurname, numbertickets, MyText
findingsales tTLA
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
put it into fld "output1"
end if
end read_in
on display_answer MyText, @buyerinfo, @buyername, @buyersurname, @numbertickets
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 "fresult"
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"
put "The total money raised for charity is:" &&totalamount into line 5 of fld "fresult"
end display_answer
on findingsales
set the caseSensitive to true
repeat until MyText is empty
put char 1 of MyText into HOLDER
if HOLDER = "s" then
add 1 to Stickets
end if
if HOLDER = "W" then
add 1 to Wtickets
end if
delete char 1 of tTLA
end repeat
put ("W = " & Wtickets && "s = " & Stickets) into fld "fResult"
end findingsales