How best to store units of measure (ft & inches, lb & oz, etc.)
Posted on 2002-04-13
I am developing a warehousing program and we need to define the dimensions of the storage locations as well as the weight of the products. I'm in the initial development phase right now and I am wondering how I should go about storing the units of measure.
We need to have the ability to define specific units of measure, like feet & inches, meters, etc and their relationship to each other (each foot has 12 inches). Obviously each measurement can have a value and sub value (feet->inches or lb->oz). Not only do I need to take into account the easiest way to store this data, but the easiest way to retrieve and use the data.
My initial thought was to create two fields. One for Unit of measure and one for sub unit of measure. This however limits us to two levels of measure and makes it impossible to have for example kilometers, meters, centimeters, etc. Then I thought maybe we could store the data in a custom designed format. Create a class to convert and use the fields as well as retrieve and store them.
What I need to know is what my best option is. What are the pros and cons to each method.