Solved

Inches to Feet & Inches?

Posted on 2004-09-03
6
4,580 Views
Last Modified: 2007-12-19
Need to convert inches to Feet & Inches, ie. 66" = 5' 6"

DB is MS SQL, Crystal Rep 9.0.

0
Comment
Question by:wcotis60
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:bdreed35
ID: 11976806
Try this in a formula:

numbervar inches := 66;

ToText(int(inches/12),0,"") & "' " & totext(remainder(inches,12),0) & "''"
0
 
LVL 28

Accepted Solution

by:
bdreed35 earned 500 total points
ID: 11976855
How is the field stored in the db?  As a number or as a string with the inches symbol?

If it is a number, my formula above will work fine.

If it is a string, you can change it this way:

numbervar inches := val('66"');

ToText(int(inches/12),0,"") & "' " & totext(remainder(inches,12),0) & '"'
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 11976913
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;
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 11976921
Of course, you need to subsitute your actual field name for the number '72' in my example...
0
 
LVL 26

Expert Comment

by:Kurt Reinhardt
ID: 11977021
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!)
0
 

Expert Comment

by:mahabat
ID: 11979571
:)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now