Copyright © 2019 EarthSoft, Inc • Modified: 04 Mar 2019
The EQUIS_UNIT_CONVERSION function allows reports to convert from one unit type to another. These conversions are defined in the RT_UNIT_CONVERSION_FACTOR table. In this table, you define the reported (start) unit, the target unit, and the conversion factor to get from one to the other. For example, if the start unit is m and the target unit is cm, then the factor would be 100, so that 1 meter * 100 (the factor) = 100 cm.
•For these units to be a selectable option in Reports, the column UNIT_TYPE must be populated in RT_UNIT.
•Conversions should be populated in both directions, e.g. [mg/L to ug/L] and [ug/L to mg/L].
•Conversion factors stored in this table cannot be used in tandem to convert values, e.g. if the conversion from [mg/uL to ppb] is desired, this conversion factor needs to be included in the table, even if both [mg/uL to mg/L] and [mg/L to ppb] are included in the table.
If there is no entry for the reported and target unit pair in RT_UNIT_CONVERSION_FACTOR, the function will throw an error indicating the missing unit conversion. Any or all missing unit conversions that are needed by the report must exist for the report to run successfully. Similarly an error will be thrown if the STATUS_FLAG of the entry for the REPORTED/TARGET_UNIT pair is set to anything other than A.
The DELTA column in the RT_UNIT_CONVERSION_FACTOR table is intended to store data needed for unit conversions. The unit_conversion function uses the value for conversions that require a sum along with a multiplication factor. Temperature unit conversions are a good example of conversions requiring a sum and multiplication factor.
•To convert from Fahrenheit to Celsius: C = (0.555556) * F + -17.777778 or
•To convert from Celsius to Fahrenheit: F = 1.8 * C + 32
The general conversion formula is: converted_value = (original_value * conversion_factor) + delta
For temperature conversions, the following fields would need to be populated.
The ability to define more complex conversions can be done using conversion formulas.