Zum Hauptinhalt springen

UnitConversion

Structure

UnitConversion(sUnitFrom, dValFrom, sUnitTo, dConversionResult) : String

Type

Function

Description

This function attempts to convert values between 2 units using the conversion values stored in the Unit of Measure Add/Edit List in IndySoft. The function returns True if conversion is successful. If the function returns False parameter sErrorMessage contains the error message.

Parameters: 5

sUnitFrom = Unit converting from

dValFrom = Value of the Unit you're converting from

sUnitTo = Unit to convert the value to
dConversionResult = the value of the converted dValFrom

sError = Error if any

Return

Returns 'True' if the conversion is successful, 'False' if not

Example:

if UnitConversion('m', 1, 'cm', dConversionResult, sError) then

ShowMessage('Conversion result:' + FloatToStr(dConversionResult))
else
ShowMessage(sError); ```<br /><br />end; ` |