Calculating numbers with currency formating
Posted: Mon Jan 04, 2010 6:30 pm
Any ideas,
I've tried the following.
setProp cDisplaySepCurrency pValue
local tSepValue
if word 1 of the name of the target is not "field" then
return "Invalid target"
else if pValue is not a number then
return "Invalid value"
else
put format ("%1.0f", pValue) into pValue
put char -6 to -1 of pValue into tSepValue
put empty into char -6 to -1 of pValue
repeat while the number of chars in pValue > 0
put char -3 to -1 of pValue & comma before tSepValue
put empty into char -3 to -1 of pValue
end repeat
put "£" before tSepValue
put tSepValue into the target
end if
end cDisplaySepCurrency
then the calculation....
put the cDisplaySepCurrency of field "Purchase_Price_1" into v_Purchase_Price
put (v_Purchase_Price * 0.1) into v_Deposit
set the cDisplaySepCurrency of field "Deposit" to v_Deposit
I get just a zero value in field "Deposit" but don't know why?
Any thoughts appreciated.
Andrew
I've tried the following.
setProp cDisplaySepCurrency pValue
local tSepValue
if word 1 of the name of the target is not "field" then
return "Invalid target"
else if pValue is not a number then
return "Invalid value"
else
put format ("%1.0f", pValue) into pValue
put char -6 to -1 of pValue into tSepValue
put empty into char -6 to -1 of pValue
repeat while the number of chars in pValue > 0
put char -3 to -1 of pValue & comma before tSepValue
put empty into char -3 to -1 of pValue
end repeat
put "£" before tSepValue
put tSepValue into the target
end if
end cDisplaySepCurrency
then the calculation....
put the cDisplaySepCurrency of field "Purchase_Price_1" into v_Purchase_Price
put (v_Purchase_Price * 0.1) into v_Deposit
set the cDisplaySepCurrency of field "Deposit" to v_Deposit
I get just a zero value in field "Deposit" but don't know why?
Any thoughts appreciated.
Andrew