Announcement

Collapse
No announcement yet.

[SOLVED] Currency field problem.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [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
    another example: 256.3 Changed to 2,563
    Appreciate your help. Thanks
    Scriptcase V8.1 Enterprise Edition.

  • #2
    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.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Thanks so much Albert. My DB is MySQL. what is the best type should i use? i have : [Decimal, Float,Double and Real] options
      Scriptcase V8.1 Enterprise Edition.

      Comment


      • #4
        Originally posted by iiiax View Post
        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.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          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?
          Scriptcase V8.1 Enterprise Edition.

          Comment


          • #6
            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?
            Albert Drent
            aducom software netherlands
            scriptcase partner, reseller, support and (turn-key) development
            www.scriptcase.eu / www.scriptcase.nl

            Comment


            • #7
              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
              Scriptcase V8.1 Enterprise Edition.

              Comment


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

                https://dev.mysql.com/doc/refman/5.1...l-changes.html

                DECIMAL(M,D)
                Albert Drent
                aducom software netherlands
                scriptcase partner, reseller, support and (turn-key) development
                www.scriptcase.eu / www.scriptcase.nl

                Comment


                • #9
                  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].
                  Scriptcase V8.1 Enterprise Edition.

                  Comment


                  • #10
                    excelente solución, gracias por compartirlo.

                    excellent solution, thanks for sharing.

                    Comment

                    Working...
                    X