Convert(Value: Variant): Variant;
Value. Converted value.
The Convert method converts the specified value.
Type of the value obtained after conversion must be determined in the IValueConverter.DataType property.
The example is given for the custom class that rounds real values.
Add links to the Cubes, Dal and MathFin system assemblies.
// Class that converts values
Class Converter: Object, IValueConverter
// Value conversion function
Public Function Convert(Value: Variant): Variant;
Begin
// Round value
Return Math.Round(Value As Double,2);
End Function Convert;
// Return type of converted values
Public Function get_DataType: DbDataType;
Begin
Return dbDataType.Float;
End Function get_DataType;
// Function for checking availability of value conversion
Public Function TryConvert(Value: Variant; Var Result: Variant): Boolean;
Begin
Try
// If conversion is available, function returns True
Result := Convert(Value);
Return True;
Except
End Try;
// If conversion is not available, function returns False
Return False;
End Function TryConvert;
End Class Converter;
See also: