AnsweredAssumed Answered

Is it safe to rely on text data in a number field?

Question asked by smith7180 on Apr 14, 2017
Latest reply on Apr 16, 2017 by philmodjunk

I have a number field in a price database that contains the price of the product.  It has to be a number field as I rely on the properties corresponding properties of a number field.  My issue:  I would like to store the currency in this field as well, and so I'm exploring whether there are any known issues with doing this. 

 

When a user inputs data into this currency field, a script trigger does a few things:

  • Looks to see if 1 of 5 accepted currency symbols prefaces the input ($, £, etc…).  Makes note if this is the case.  If not, the value is considered to be in the default currency.
  • Next it does typical validation stuff like stripping out non-numeric characters.
  • Finally it formats the currency according to the conventions for the selected (or default) currency.

 

My question is this: are there any known pitfalls to relying on text stored in a number field like this?  For example, if I add two of these fields, the output will not have the currency symbol  This is desired behavior, and I simply format the output with other scripts.  My concern is that some other action down the road (like importing) will strip out the text characters.

 

In short, is it problematic to work with and rely upon text data in a number field?

Outcomes