Here's my code:-
Code: Select all
on mouseup
put 0 into fld "cmsdone"
repeat while fld "cmsdone" is 0
repeat until dimension1 is a number
ask "Enter the dimension, for example the length, of the product as purchased (numerals only, in centimetres)" titled (fld "fieldboxtitle" of cd "template1")
put it into dimension1
if dimension1 is not a number or dimension1 <0 then
put empty into dimension1
answer "Try again. You must enter a numeric value above zero" titled (fld "fieldboxtitle" of cd "template1")
end if
end repeat
repeat until cutdimension is a number
ask "Enter the dimension, for example the length, of the product as used in the product (numerals only, in centimetres)" titled (fld "fieldboxtitle" of cd "template1")
put it into cutdimension
if cutdimension is not a number or cutdimension <0 then
put empty into cutdimension
answer "Try again. You must enter a numeric value above zero" titled (fld "fieldboxtitle" of cd "template1")
end if
end repeat
repeat until pieces is a number
ask "Enter the number of these pieces as used in the manufactured product (numerals only)" titled (fld "fieldboxtitle" of cd "template1")
put it into pieces
if pieces is not a number or pieces <0 then
put empty into pieces
answer "Try again. You must enter a numeric value above zero" titled (fld "fieldboxtitle" of cd "template1")
end if
end repeat
repeat until wastefactor is a number
ask "Enter the approximate waste factor as a percentage, when producing the pieces for the manufactured product (numerals only)" titled (fld "fieldboxtitle" of cd "template1")
put it into wastefactor
if wastefactor is not a number or wastefactor <0 then
put empty into wastefactor
answer "Try again. You must enter a numeric value above zero" titled (fld "fieldboxtitle" of cd "template1")
end if
end repeat
put fld "stock" & tab & fld "compcode" & tab & fld "description" & tab & fld "usualquantity" & fld "cost2" & tab & dimension1 & tab & cutdimension & tab & pieces & tab & wastefactor into theText
put false into firstLineContainsColumnNames
dispatch "addline" to grp "DataGrid 1" with theText
filter rows without empty
put fld "stock" & tab & fld "codep" & tab & fld "description" & tab & fld "usualquantity" & fld "cost" & fld "disc"into theText
put false into firstLineContainsColumnNames
dispatch "addline" to grp "DataGrid 1" with theText
filter rows without empty
Answer question "Enter another different size piece of this component as a part of the manufactured product ?" with "YES" or "NO" titled field "fieldboxtitle" of cd "template1"
if it is "yes" then
end if
if it is "NO" then
put 1 into fld "cmsdone"
end if
end repeat
User answers "No", not a problem, everything stops.
User answers "Yes", I expected the whole shooting match to repeat from the top; what I get is a repeat of the question, "Enter another different size piece...?" until I select "No".
Can't figure out why the complete queationnaire from the top is not invoked.