Solved

Inches to Feet & Inches?

Posted on 2004-09-03
6
4,657 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 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