Solved

Inches to Feet & Inches?

Posted on 2004-09-03
6
4,629 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 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.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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