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

Setting Decimal places by report

Status
Not open for further replies.

furthur

Technical User
Nov 1, 2000
9
0
0
US
I am using CR7, and am wanting to set number fields to show two decimal places (by using the File|Option menu, clicking the Fields tab, and then formatting Number fields to show two decimal places) and then saving that formatting with the report. When I run a different report, I want it to round to 0 decimal places. The problem I am having is that formatting number fields in this manner seems to save it for the Crystal Reports application, not by individual report. I don't want to have to set the number formatting every time I run a different report; I want those settings saved with the report.

Am I doing something wrong, or is there a way around this?

To give a little more detail, when I use a formula within another formula, it rounds based on what the number format is set to for the whole report. I need the formula to be able to differentiate between .82 and .85 and can only get it to do so when I format the numbers in the above manner.

Any help would be appreciated.
 
What you are changing will only effect the next number object added to a report.
To change/save numeric format settings with the report, select the field(s) after they are placed on the canvas. Then use Format-Field or format-Objects and set your formatting options. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
That only works if I have the formula on the canvas. I can use Format-Field so it displays .82 instead of 1.00, but if I use that formula in another formula, I can't seem to make it use .82.

Assume Numbers are formatted to round to 0 decimal places for the report.

@Formula1 : 82/100

I can place @Formula1 on the canvas and then format it to round and display as .82

@Formula2: @Formula1 * 50

When I place @Formula2 on the canvas, it displays 50, not 41, because it has rounded @Formula1 to 1 inside of @Formula2. If I format @Formula2 to round and display two decimals, it displays 50.00.

I also tried @Formula2: round(@Formula1,2) * 50, but got the same results. The only way I can get @Formula2 to display 41 is to to change the global setting for Number fields, which I don't want to do.

 
If it only works when Formula1 is on the canvas (I'm assuming that you don't want Formula1 to display), place that field on the canvas, then format the field so that it is suppressed. You can do that by checking the box to the right of the Suppress option on the Common tab of the Format Editor.
 
What version of CR are you using?

I don't get the same behavior at all. I couldn't get formatting to affect the underlying value of the formula, only how it is displayed.

You could try the solution suggested by Lucy or you could make your first formula:

Round (82/100, 2) to try to force a value.

Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top