Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Number Formatting Issue 1

Status
Not open for further replies.

wcp

MIS
Aug 7, 2003
12
US
I have a field where I want to display a series of numbers in a formula. The numbers can range with any number of decimal places, usually no more than 7 but they can be whole numbers as well. Whenever I use them in a formula, I convert them to strings for concatination purposes, however they will appear based on my number formatting, so I'm getting

11.00 instead of 11
8.50 instead of 8.5
3.65 instead of 3.655

I just want to display the actual number I'm bringing in without any special formatting/rouding off of the decimal places. Is this possible?? I'm using Crystal Reports V9.

Thanks in advance!!!
 
Hi wcp,
I think this is what you may be looking for, I created it as a function:

Function (numberVar vDecimalTest)

numberVar vDecimalPlace;

if vDecimalTest=tonumber(totext(vDecimalTest,0)) then vDecimalPlace := 0 else
if vDecimalTest=tonumber(totext(vDecimalTest,1)) then vDecimalPlace := 1 else
if vDecimalTest=tonumber(totext(vDecimalTest,2)) then vDecimalPlace := 2 else
if vDecimalTest=tonumber(totext(vDecimalTest,3)) then vDecimalPlace := 3 else
if vDecimalTest=tonumber(totext(vDecimalTest,4)) then vDecimalPlace := 4 else
if vDecimalTest=tonumber(totext(vDecimalTest,5)) then vDecimalPlace := 5 else
if vDecimalTest=tonumber(totext(vDecimalTest,6)) then vDecimalPlace := 6 else
if vDecimalTest=tonumber(totext(vDecimalTest,7)) then vDecimalPlace := 7;
totext(vDecimalTest,vDecimalPlace,"")

Hope this helps,
Jacque
 
Jacque,

Thank you very much!!! It worked wonderfully!!!

Thanks again!!

WCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top