41 Posts
RatingAction
4 years ago
0
Topic

I've got a field set up that calculates a value automatically based on other values in the form. The field type for this "Text". The calculation is set in the "Computational Rules" part of the admin form. I want to display three figures after the decimal point and so have set "Format / Precision" as "toFixed / 3". I've experimented with various datatypes, but do not get the result I want:

  • If I set the data type as "VARCHAR" the value is displayed as I wanted, i.e.with three figures after the decimal point. However, ordering does not work properly and the article order if I order by this field is all over the place (even if setting the search configuration to "Numeric").
  • If I set the data type as "DECIMAL(10,3)" the ordering works as I want it to, but all values are rounded down to the next integer and the three figures after the decimal point are zeros.

How do I need to set a field up so it stores figures with three decimal points as numbers so I can sort numerically?

Get a Book for SEBLOD