We used to use the Decimal field to store a numerical monetary value. Last week, we realized that for values over $999,99, the last digit was being rounded. (Apparently the values were still in the database, but were not displaying correctly in either the record or Views.)

I installed the Money module (and Currency), and in SQL I copied the values from the old decimal field (*100) to the new field_amount1_amount field, and then set field_amount1_currency to "USD" for all records.

Everything looks normal in Views, and everything seems to work properly in records created since then, but when we click an entry to view an individual record, the new Amount1 value is not displaying, and when we try to edit that record, the Amount1 value is being set to USD 0.00. I looked in the CCK content_type_... table for this content type and I can't see any difference between new (working) records and old (weird behavior) records.

I reported the problem in CCK Money issues and Wim Leers responded:

The module isn't aware of how the data is stored. CCK handles that. What you have done, is one big hack… you probably have to add entries in some other, mysterious table.

You should ask some CCK guru (KarenS, yched, …), or ask in the CCK issue queue how to "transform" one CCK field into another.

Does anyone have any further suggestions? Where else does this module store info?

Comments

emdalton’s picture

Title: Converting CCK Decimal values to CCK Money » Converting CCK Decimal values to Text

We really need some help with this. CCK Money hasn't worked out for us, and now I'm trying to move this data to a text field. I have 481 records that have data in numeric form that needs to go into a text field instead. When I try to use a statement like this:

UPDATE content_type_casetracker2_basic_case SET field_amount2_value = field_amount1_amount;

I don't see the values in the CCK node afterward. I also tried a simpler statement:

UPDATE content_type_casetracker2_basic_case SET field_amount2_value = "unset"; to just put a bit of text into each field, and I can see these values in the database, but not in the nodes. What else do I need to do to get CCK to recognize the data that has been set in the new fields???

deep’s picture

Experience similar issues.

Using decimal field and after entering 4 digit + 1 decimals all ok.

Buf after enering 6 digit+1 decimale, "139999.5" for example gets rounded to "140000"

emdalton’s picture

Title: Converting CCK Decimal values to Text » CCK Decimal has insufficient precision
Category: support » bug

CCK decimal fields will only display 5 digits of precision, even though more decimal places are stored in the database. Is this fixed in Drupal 6? We really need to be able to store and manipulate values of greater precision than 5 digits.

karens’s picture

Status: Active » Closed (won't fix)

See #501016: Big numbers (>10,000) get rounded up. This is a limitation of the float type used in D5. It won't get fixed in D5.