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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Integer Conversion 3

Status
Not open for further replies.
Aug 28, 2003
18
CA
I noticed in Crystal that there is no fuction to convert a number to integer. If I display a field which is an integer in a report, it converts it to double (with a decimal and 2 zeros). If I try to manipulate this field in a formula field, they have the following: CDbl, CCur, CBool, CDate, etc. No CInt ??? How can I get these numbers diplaying as integers and not in double format?

Any help is much appreciated.
 
Format the field itself and look under number. There a chart of the different "styles" to print the numbers. There is also a button at the bottom of the chart titled Customize. Click on that button and you can format the field the way you want.

 
Formatting a field being displayed was no a problem. Displaying that field in a formula field was an issue.

Found a way around it though using the ToText() command.

E.g. ToText(value, 0, "")


Thanks.
 
That is good, but it seems it would be going the wrong direction if you are doing a calculation on the number. But if it works, great.
 
It doesn't convert it to double. It converts it to your default number format. Go to File/Options... Fields tab, Number button to see what you default set up is.

Mike
 
You should be able to remove decimal places using the icons on your formatting toolbar.

You can also set your own defaults. A crystal report normally has defaults for the format of the different types of field. In Crystal 8.5, they are found at the [File] tab, which you get to by choosing [Options] on the [File] menu. But note that this may change when the same report is run on someone else's machine.
Another approach - long-winded but safe - is to format values. Say Totext({your.number}, 0), which ensures no decimals.


[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top