You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Stanley Styszynski <di...@gmail.com> on 2008/10/15 12:58:57 UTC

How to store values that might be given in different measurement units?

Hi All,

I would appreciate any thoughts on the following topic:
How to store values that might be given in different measurement units?

For example weight. It can be in pounds or kilograms.

Basically, I am writing an application in which user can enter some values
(weight, height and some medical measurements)
in different units and I want to store this in Derby database. I don't know
if it would be better to store these values in one unit
and convert it if needed or to create separate columns for each possible
unit and retrieve them using special query?
Maybe there is some other way of doing this?

Regards

Stan

RE: How to store values that might be given in different measurement units?

Posted by "Henderson, Roy" <ro...@eu.weatherford.com>.
My approach for this particular situation would always be to store the
value in a known unit. If varying presentation units were required for
the interface, then I would convert transparently. Thus, I would
probably store weight in either g or kg and convert between imperial if
required.

 

Roy

 

________________________________

From: Stanley Styszynski [mailto:diabeteo@gmail.com] 
Sent: 15 October 2008 11:59
To: derby-user@db.apache.org
Subject: How to store values that might be given in different
measurement units?

 

Hi All,

 

I would appreciate any thoughts on the following topic:

How to store values that might be given in different measurement units?

 

For example weight. It can be in pounds or kilograms.

 

Basically, I am writing an application in which user can enter some
values (weight, height and some medical measurements)

in different units and I want to store this in Derby database. I don't
know if it would be better to store these values in one unit 

and convert it if needed or to create separate columns for each possible
unit and retrieve them using special query? 

Maybe there is some other way of doing this?

 

Regards

 

Stan

 


===============================
CONFIDENTIAL & PRIVILEGED COMMUNICATION 

The information contained in this message is privileged, confidential, and protected from disclosure. 
This message is intended for the individual or entity addressed herein. If you are not the intended recipient,
please do not read, copy, use or disclose this communication to others. Also please notify the sender by 
replying to this message, and then delete it from your system. The sender totally disclaims, and will not 
accept, any responsibility or liability for the unauthorized use, or the consequences of any unauthorized use,
of this communication or message.

Re: How to store values that might be given in different measurement units?

Posted by Daniel Noll <da...@nuix.com>.
Donald McLean wrote:
> I don't think that separate columns for each type of unit would be a
> good choice. I agree with Roy that the most straightforward approach
> would be to just convert to a standard unit. Where I work this is what
> most people (including me) do.
> 
> However, if you want an alternate approach, you could store the value
> in one column and the units in another.

And as long as you never need to sort on that column, then there is 
probably no drawback.  Though personally if I didn't need to sort, I 
would probably use a string.  JScience should cope with parsing and 
formatting well enough, and it guarantees no loss in precision.

Daniel


-- 
Daniel Noll                            Forensic and eDiscovery Software
Senior Developer                              The world's most advanced
Nuix                                                email data analysis
http://nuix.com/                                and eDiscovery software

Re: How to store values that might be given in different measurement units?

Posted by Donald McLean <dm...@gmail.com>.
I don't think that separate columns for each type of unit would be a
good choice. I agree with Roy that the most straightforward approach
would be to just convert to a standard unit. Where I work this is what
most people (including me) do.

However, if you want an alternate approach, you could store the value
in one column and the units in another.

On Wed, Oct 15, 2008 at 6:58 AM, Stanley Styszynski <di...@gmail.com> wrote:
> Hi All,
> I would appreciate any thoughts on the following topic:
> How to store values that might be given in different measurement units?
> For example weight. It can be in pounds or kilograms.
> Basically, I am writing an application in which user can enter some values
> (weight, height and some medical measurements)
> in different units and I want to store this in Derby database. I don't know
> if it would be better to store these values in one unit
> and convert it if needed or to create separate columns for each possible
> unit and retrieve them using special query?
> Maybe there is some other way of doing this?
-------------------------------------------------------------
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Re: How to store values that might be given in different measurement units?

Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
For the next release, a generated columns feature is being worked
on. When that gets added, one could get both a way to store the
original data, as well as a generated column with a converted
(canonical unit) measure (and not risk losing precision of original
data) for which sorting could be applied.

Dag