This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Converting iso units to true values (tera,giga.mega,kilo,milli,micro,nano,pico) for easy searching.

tmandeville - Wednesday, December 21, 2011 5:44 AM:

We are attempting to manage certain numerical properties of electronic components.
The properties may be entered using a numerical value and a symbol character that
represents the scale of value. e.g "1.2" "Mega" = "1200" "Kilo" = 1200000

The value and symbol can be applied to multiple properties. Amps,Watts, Ohms, volts etc

regardless of the format used when entering the data on the form we wish to store these values in the database as true values (floating point or exponential) that can be searched and retrieved by engineers using different combination of values and scaling characters in their search criteria.

e.g. I can enter search criteria as 1.2 Mega volts or 1200 Kilo volts or 1200000 volts and get the same list of records returned

 

Prefix Symbol  10 n   Decimal              notation
tera      T          10 12 1000000000000   1E12
giga     G          10 9   1000000000         1E9
mega   M         10 6    1000000               1E6
kilo       K          10 3   1000                     1E3
 -          -           10 0    1 
milli      m         10-3    0.001                   1E-3
micro   μ          10-6    0.000001             1E-6
nano    n          10-9    0.000000001       1E-9
pico     p          10-12  0.000000000001 1E-12

has anybody written code for translation of values*symbol that stores a result as a true value,



PeterSchroer - Wednesday, December 21, 2011 6:25 AM:

Hi Xyratex,

We have a design spec started for a standard solution to managing "Units".     Sounds similar to your approach:   Create a new ItemType named Units, which has a Name property (such as Linear),  and a relationship to Null.  On the Relationship are several proprties     Name, Symbol, and Conversion-Factor.      The Client and any incoming AML has to set an attribute on the Property (which unit I am using) plus the property value.   The Server OnBeforeSave uses the UNITS data model to transfer this value to the native stored format.     ServerOnAfterGet would apply the Math in the opposite direction.

Our plan was to declare a new Property Type which  specifies which Units family it represents.   Then add to the Preferences the ability for the user to set a default Units (inches for example) that they want to see data mapped to.       You could certainly implement all of this as a customization,  or I would be happy to collaborate with you on building the standard solution.    if you want to collaborate - drop me an email  [email protected]

peter.