Add. & Sub. Error - Operators -: error in left operand
Posted: Sat Sep 19, 2015 2:03 pm
Hi, All
I am having some difficulty getting a button to work that adds the result of two text entry field sections, and then subtracts the addition of the two sections from an original text entry field. I am including the code below and explain the throughout process along the way. Still new at this so forgive me if the answer is straight forward.
on mouseUp
local A1, A2
put the text of field "IncomeEntryField" into A1 -- this is the text entry field where an amount is entered
put field "LongTerm1Amt" + field "LongTerm2Amt" into field "LongSubTotal" -- This adds two text entry fields into a label
put field "ShortTerm1Amt" + field "ShortTerm2Amt" into field "ShortSubTotal" -- This adds two text entry fields into a label
put the text of field "LongSubTotal" + the text of field "ShortSubTotal" into field "StageField" -- This adds the label values together
put the text of field "StageField" into A2
put A1 - A2 into field "IncomeAfterDebtLabel"
end mouseup
It applies correctly however when I run the application I get the error:
Button "LongShortCalculate" error Operators -: error in left operand
It is rather strange if I substitute "IncomeEntryField" with "LongSubTotal" for example it works, but the moment I use the other field it fails.
Hope you can help, appreciate the assistance.
I am having some difficulty getting a button to work that adds the result of two text entry field sections, and then subtracts the addition of the two sections from an original text entry field. I am including the code below and explain the throughout process along the way. Still new at this so forgive me if the answer is straight forward.
on mouseUp
local A1, A2
put the text of field "IncomeEntryField" into A1 -- this is the text entry field where an amount is entered
put field "LongTerm1Amt" + field "LongTerm2Amt" into field "LongSubTotal" -- This adds two text entry fields into a label
put field "ShortTerm1Amt" + field "ShortTerm2Amt" into field "ShortSubTotal" -- This adds two text entry fields into a label
put the text of field "LongSubTotal" + the text of field "ShortSubTotal" into field "StageField" -- This adds the label values together
put the text of field "StageField" into A2
put A1 - A2 into field "IncomeAfterDebtLabel"
end mouseup
It applies correctly however when I run the application I get the error:
Button "LongShortCalculate" error Operators -: error in left operand
It is rather strange if I substitute "IncomeEntryField" with "LongSubTotal" for example it works, but the moment I use the other field it fails.
Hope you can help, appreciate the assistance.