Method Community

 

Decimal Places in Money Field

Last post 09-07-2012 1:09 PM by Anonymous. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-06-2012 4:00 PM

    • Rolf
    • Top 50 Contributor
    • Joined on 09-18-2011
    • Posts 109

    Decimal Places in Money Field

    I have a field of type Money which I would like to restrict to whole $ amounts only, and have set the formatting option to 0 decimal places.  If I type in a whole number value, it works fine.  If, however,  I type in a value with a decimal point, then regardless of the actual decimal values, or how many decimal places I type in, the display is always showing the default value of two decimal places.

    I tried a workaround of extracting the whole number portion of the entry, and writing it back into the field,  but it turns out that doing this will again cause 2 decimal places to be displayed, regardless of the value written back into the field

    Any suggestions on how to fix this?

  • 09-06-2012 5:00 PM In reply to

    Re: Decimal Places in Money Field

    Rolf:
    Any suggestions on how to fix this?

    I'm just reviewing the money field type with 0 decimal places and will post back if there's an issue (or workaround).

    ~C

  • 09-07-2012 9:14 AM In reply to

    Re: Decimal Places in Money Field

    Rolf:
    Any suggestions on how to fix this?

    Any Money or Decimal field in Method will always store as 2 decimal places regardless.  The decimal limitation you see on the field and in the table is for display purposes only.  In my screenshot you'll notice I have 4 decimal fields each set to 0, 1, 2 and 3 decimal places and one money field set to 2 decimal places.  During text entry there is no limits and in my screenshot I typed 50.1111 for all fields then submitted.  I then loaded the row again so you can see how its displayed back.

    My suggestion to you is to use the Integer field instead of Money or Decimal to truly limit your entry to whole numbers.  Alternatively you can use on Text Change actions to round up or round down the number before they get saved but they still go into the database with 2 decimal places.

    HTH

    ~C

  • 09-07-2012 9:23 AM In reply to

    Re: Decimal Places in Money Field

    Rolf:
    Any suggestions on how to fix this?

    Another approach would be to use a Basic Math Calculation on Text Change to multiple the field by 1 and round up or down as desired.  If your field type is Decimal or Money it'll still store as .00 but it'll be consistent.

    HTH

    ~C

  • 09-07-2012 9:44 AM In reply to

    Re: Decimal Places in Money Field

    Answer

    Rolf:
    Any suggestions on how to fix this?

    One last approach, which might be the prefered solution, is to use 2 character functions followed by an enter value into field on screen - like this.

    1. The first action get's the position of the .
    2. The second action get's all the characters to the left of the . and puts that into an Action Result
    3. The final action enter's the AR above into the field on screen.

    This is might be the cleanest solution as the display and storing of the value is consistent.

    ~C
  • 09-07-2012 11:25 AM In reply to

    • Rolf
    • Top 50 Contributor
    • Joined on 09-18-2011
    • Posts 109

    Re: Decimal Places in Money Field

    Thanks for your efforts on this Chad,

    You're getting the same kind of results that I did, which is of course to be expected.  I already tried all the workarounds you suggested, including this last one, none of which actually get rid of the issue.

    I can't change the field type because it's the Quckbooks Net Pay field.  So it appears the only solution at this point is for people to enter only the whole number portion, and then that's all that will display.

    Anyway, thanks again for your help on this,

    Rolf

  • 09-07-2012 1:09 PM In reply to

    Re: Decimal Places in Money Field

    Rolf:
    I can't change the field type because it's the Quckbooks Net Pay field.

    I had a feeling this might be the case - there's not much you can do other than to utilize on text change actions to correct the display/input.

    ~C

Page 1 of 1 (7 items)