UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> UnitsOfMeasure    
UnitsOfMeasure

This page is a stub. Please help us by expanding or merging it with applicable content

Handling Units of Measure can be a difficult concept at times. In complex applications, UMs may range from counts of items to units of length, weights, or any number of literally thousands of different possibilities. Along with the requirement to let users select particular UMs based on the context, often we must also have the ability to convert units from one type to another for calculation purposes.

A well handled, universal Unit of Measure system essential as our applications become more and more complex. You want to be able to reference certain UMs here, certain UMs there, certain types of them in this context or that context, but things can get a little messy if we build these on the fly for each time they are required. If we do that, then management becomes difficult if not impossible.

Further discussion in methods involving storage of unit-releated values can be found in Richard Broersma's blog entry on Updatable Views. He discusses an important concept of storing all data under a single system to greatly simplify the conversions required thereafter (specifically with SQL views).

Attached is a sample database (2000 format) that contains a number of tables (for the UMs, their grouping, and their conversion factors) as well as a module with a few functions that demonstrates one way to handle a universal UM system that can be expanded upon based on the developers needs.

The functions that are most likely to be used during the interface design are:

  • ConvertUnit()
  • GetUMSql()

The ConvertUnit function performs a unit conversion based on an expression found the the conversion table. The GetUMSql functions returns a SELECT statement that can be used as a recordsource for a combo box. There are also functions to return the Code or Description for a given ID.

media:UnitsOfMeasure.zip

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 3,263 times.  This page was last modified 02:09, 9 February 2012 by Jack Leach.   Disclaimers