OK, I'm probably the only person here who has use for this, but I feel like contributing. My company moves heavy and large machinery, so we often need to convert specs that show measurements in inches only to feet and inches, or likewise with centimeters. Here's the code I use in my Workorder application:
Elements used: CM, Feet, Inches
First, the centimeters conversion, if needed:
** PROGRAMMING SECTION: [CM] [On Element Change] **
// Converts Centimeters to Inches
Inches = CM * 0.393700787
Then, change inches to feet and inches:
** PROGRAMMING SECTION: [LENGTH_INCHES] [On Element Change] **
// Changes inches over 12 to extra feet and inches
var vExtraInches as Double
var vExtraFeet as Double
var vExtraFeetInches as Double
if Inches > 12 then
{
vExtraFeetInches = (Inches / 12)
vExtraFeet = @Int(VExtraFeetInches)
vExtraInches = (VExtraFeetInches - vExtraFeet)
vExtraInches = (VExtraInches * 12)
Feet = Feet + vExtraFeet
Inches = vExtraInches
}
IF Inches = 12
THEN
{
Feet = Feet + 1
Inches = 0
}