I have four text fields for the user to enter dollar amounts - hopefully no $ (do we use the delimiter to parse out a possible "$" - must be only numbers
--Premium Subtotal Calculation
put the value of field "fldBiWeekPrem1" into varPrem1Add
put the value of field "fldBiWeekPrem2" into varPrem2Add
put the value of field "fldBiWeekPrem3" into varPrem3Add
put the value of field "fldBiWeekPrem4" into varPrem4Add
put the value of varPrem1Add+varPrem2Add+varPrem3Add+varPrem4Add into varSubtotal
set the text of field "fldPremSubTotal" to it
How do I add up fields into a subtotal field?
Mike
Last edited by karmacomposer on Fri Jul 20, 2018 4:53 pm, edited 1 time in total.
...
put fld "my field" into tFieldContent
...
## And
## put the value of varPrem1Add+varPrem2Add+varPrem3Add+varPrem4Add into varSubtotal
put varPrem1Add + varPrem2Add + varPrem3Add + varPrem4Add into varSubtotal
...
And SPACES do not hurt, but make the scripts more readable!
function goodNumber tText
repeat for each char theChar in tText
if theChar is in ".0123456789" then put theChar after temp
end repeat
return temp
end goodNumberr
# Allow only digits - no letters or symbols
on keyDown pKey
if pKey is not a number then
## If the parameter is not 0-9
## prevent text entry
else
## Allow text entry by passing the keyDown message
pass keyDown
end if
end keyDown