[SOLVED] Currency field problem.

Hello.
I have a field {total} it was created as integer in the DB then i changed it to currency in SC
If i wan to type for example 12.5 SC accept only 12 and preventing me from typing [point] and the following digits.
i tried to type it in the Notepad then copy => paste in the field and guess what happen! the value is 125 :eek:
another example: 256.3 Changed to 2,563
Appreciate your help. Thanks

If a field is stored as integer you cannot store currency. So first you need to change the field in your db to numeric 10,2 or something similar. Depends on the db. Then you go to application -> synchronize. After that you can change the fieldtype to currency which will have no issues any more.

Thanks so much Albert. My DB is MySQL. what is the best type should i use? i have : [Decimal, Float,Double and Real] options

I think decimal. Then you can decide how many digits there are before the , and after. It is stored the exact way which is required in financial world. float, double and real uses a packed form which can lead to rounding.

Thanks Albert. I’ve done the changes as you describe but still can not type the [Decimal Separator] Also still can not copy and paste it from Notepad,
What i did is:

  • Changed {total} field to [Decimal] in my DB.
  • Synchronized table in SC.
  • In SC i changed the filed to [currency].
  • Disabled Regional Settings.
    any idea?

how many digits have you declared at decimal? You need to specify at least 10,2 or something similar. Depending on your local settings you might encounter issues with . and , but in this case I still think you have no decimals in your database. Is that correct?

Hello.
Field {total} in my DB is Decimal(25), Actually i added some values but with no decimal Separator because the field did not accept it. i use the default values for [.] and [,]. Thanks

Then look at the sql syntax. You need to define decimals to get it to work:

https://dev.mysql.com/doc/refman/5.1/en/precision-math-decimal-changes.html

DECIMAL(M,D)

Thanks so much Albert. problem solved. Field type: Decimal, Length: 10,2
It is very important to tick this option in currency field: [Auto-complete with zeros].

excelente soluci?n, gracias por compartirlo.

excellent solution, thanks for sharing.