How to store measurement data  
Author Message
acarnefix





PostPosted: Wed Apr 14 22:44:50 CDT 2004 Top

SQL Server Developer >> How to store measurement data

I am in need of some advice on how I should store data for customer
measurements. The measurements could be entered as a number of different
types like inches/centimeters, pounds/kilograms, as well as different
shoe size types.

The user is going to into their size for a specific measurement like
height then choose inches or centimeters as the measurements value type.
I think what I am going to do is always convert this value to a base
type like if they type in a measurement that is inches or centimeters I
will always convert to centimeters. This way the data in the table is
always in a standard format.

So adding new data into the system seems fairly easy. The problem that I
don't know how to solve is dealing with getting the data back out. When
the data is retrieved by my application it has to be displayed in the
same manner that it was entered. Meaning that if height was entered in
inches and converted to centimeters when inserted into the table then
when its retrieved it has to be displayed as inches. Now the only way
that I can think that the application can know to do this is if I store
either 'in' or 'cm' in a column for each measurement type there is. This
way I know how the user entered the data and I can retrieve and display
it properly. I would love to hear your opinion on this.

Regards,

Aaron Prohaska

-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
Wrench Science Inc.
http://www.hide-link.com/
Phone: 510.841.4748 x206
Fax: 510.841.4708
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-

SQL Server174  
 
 
Grant





PostPosted: Wed Apr 14 22:44:50 CDT 2004 Top

SQL Server Developer >> How to store measurement data Aaron,

I believe you are on the right track. I would actually have my application
do the conversion to the metric format and send whether the original value
was taken in metric or english units. You could then hold this value in an
additional column within your table. Thus when the record was recalled you
would send the metric value back to the application and the original entered
format. The application would then do the conversion (if necessary). This
would ensure that the application was taking care of the presentation alone.
However, you could create a view with the basic calculations from metric to
english units and allow it to do the calculations for you. Either way I
think its more of personal preference on whether you wanted to do the
conversion in the application or the database.

HTH,
Grant




> I am in need of some advice on how I should store data for customer
> measurements. The measurements could be entered as a number of different
> types like inches/centimeters, pounds/kilograms, as well as different
> shoe size types.
>
> The user is going to into their size for a specific measurement like
> height then choose inches or centimeters as the measurements value type.
> I think what I am going to do is always convert this value to a base
> type like if they type in a measurement that is inches or centimeters I
> will always convert to centimeters. This way the data in the table is
> always in a standard format.
>
> So adding new data into the system seems fairly easy. The problem that I
> don't know how to solve is dealing with getting the data back out. When
> the data is retrieved by my application it has to be displayed in the
> same manner that it was entered. Meaning that if height was entered in
> inches and converted to centimeters when inserted into the table then
> when its retrieved it has to be displayed as inches. Now the only way
> that I can think that the application can know to do this is if I store
> either 'in' or 'cm' in a column for each measurement type there is. This
> way I know how the user entered the data and I can retrieve and display
> it properly. I would love to hear your opinion on this.
>
> Regards,
>
> Aaron Prohaska
>
> -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
> Wrench Science Inc.
> http://www.wrenchScience.com/
> Phone: 510.841.4748 x206
> Fax: 510.841.4708
> -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-