wcotis60
asked on
Inches to Feet & Inches?
Need to convert inches to Feet & Inches, ie. 66" = 5' 6"
DB is MS SQL, Crystal Rep 9.0.
DB is MS SQL, Crystal Rep 9.0.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's a formula that works for me:
NumberVar FeetConv;
NumberVar JustFeet;
NumberVar JustInches;
StringVar FeetText;
//Provides the base number of Feet and Inches in decimal format (5.5)
FeetConv := (72 / 12);
//Provides the base number of the Feet
JustFeet:= Truncate(FeetConv);
//Provides the base number of the Inches
JustInches := (FeetConv - JustFeet) * 12;
//Converts the Feet and Inches to Text for concatenation
FeetText := ToText(JustFeet,0) + "' " + ToText(JustInches,0) + '"';
//The resulting value...
FeetText;
NumberVar FeetConv;
NumberVar JustFeet;
NumberVar JustInches;
StringVar FeetText;
//Provides the base number of Feet and Inches in decimal format (5.5)
FeetConv := (72 / 12);
//Provides the base number of the Feet
JustFeet:= Truncate(FeetConv);
//Provides the base number of the Inches
JustInches := (FeetConv - JustFeet) * 12;
//Converts the Feet and Inches to Text for concatenation
FeetText := ToText(JustFeet,0) + "' " + ToText(JustInches,0) + '"';
//The resulting value...
FeetText;
Of course, you need to subsitute your actual field name for the number '72' in my example...
LOL, breed35 and I have posted at the same time on multiple threads now - i'm giving him grief in IM ;-).
His post is much less verbose, which is a good thing for experienced developers. I try to spell things out with variables to make it a little more clear what is going on.
I would accept breed35's answer ;-) (can't believe I'm saying that!)
His post is much less verbose, which is a good thing for experienced developers. I try to spell things out with variables to make it a little more clear what is going on.
I would accept breed35's answer ;-) (can't believe I'm saying that!)
:)
numbervar inches := 66;
ToText(int(inches/12),0,""