ISCDOPhysUnit.ConvertValue

Description

This function returns the value converted from the origin physical unit to the specified.

Syntax

object.ConvertValue(OrigValue, OrigUnit)

Part Attribute Type Description
object Required
The object always implements the ISCDOPhysUnit interface
OrigValue In, Required
Single
The original value to be converted
OrigUnit In, Required
The original physical unit of the convertible value

Return Value

Single

Returns the value converted from the origin physical unit to the specified.

Example

Display the number of the physical units of the specified physical quantity and some information about them, including their names and values converted into the source physical unit.

Dim aSrcUnit, aUnit
Dim aPhysQuantity
Dim aValue
Dim i
Dim aMessage

Set aSrcUnit = Profile.FindCDOPsysUnitByText("g")
set aPhysQuantity = aSrcUnit.PhysQuantity

aMessage = "Source Physical Unit: " & aSrcUnit.Name & vbNewLIne &_
  "Physical Quantity System Unit: " & aPhysQuantity.SysUnit.Name & vbNewLIne &_
  "Other Units of the Physical Quantity: "

for i = 0 to aPhysQuantity.PhysUnitCount - 1
  set aUnit = aPhysQuantity.PhysUnit(i)
  aValue = aSrcUnit.ConvertValue(1, aUnit) 
  
  aMessage = aMessage & vbNewLine & (i + 1) & ") " & aUnit.Name &_
    " (= " & aValue  & " " & aSrcUnit.Name & ")"
next 
 
Profile.MsgBox(aMessage) 
Note: In Profile Client v8 on User Interface CDO Physical Units can be found in Maintain > Units and Measures.

See also

Version information

Added in v7.8.0