Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3570
  • Last Modified:

Crystal Reports-Remove decimals in TOTAL

I am writing a subreport which will total dollar amounts for selected records and bring this back to the main report.  However, I need a way to create the total without a decimal point.  I tried using the "SUMMARY" feature (to sum all of the records) but it HAS to have a decimal separator.  i tried creating a formula, adding up all of the records (to a shared variable) and then reformatting the variable, but it did not work.
Any suggestions?

Help!
0
mbroad02
Asked:
mbroad02
  • 3
  • 2
  • 2
2 Solutions
 
mlmccCommented:
You should be able to format it with 0 decimal places.

Another way is to convert it to a string with

CStr({YourField},0)

mlmcc
0
 
mbroad02Author Commented:
let me clarify: I do not wish to lose the "cents" part of the amount.  I would like 3125.65 to look like 312565.

I can't do this in the number reformatting section.  

I created a numbervar, adding up the amounts to it and then, right before I display on the report, I used the CStr({YourField},0) command.  It did not work, however.  The decimal point is still there.
0
 
mlmccCommented:
Try this

CStr({YourField}*100,0,'','')

mlmcc
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
James0628Commented:
Put your numeric field on the report, go to the field format and on the Number tab, click on Customize.   On the Number tab there, delete the "." that's (presumably) shown in the "Decimal Separator" box, then click on the formula (X+2) button beside that.  Enter "" (with no space) as the formula.  That should give you no decimal separator.

 Technically, it's not necessary to delete the "." that shows in the "Decimal Separator" box.  What's in the formula will override it.  But I think it's "clearer" to delete it and leave that box empty.

 FWIW, you can use this same kind of trick in a number of ways to customize numeric formats.  For example, the various separators and other symbols are normally limited to a single character, but you can use the formula button to enter a multiple character string.

 James
0
 
James0628Commented:
Just to correct something in my last comment:

 You _can_ enter more than one character for the separators and other symbols in a numeric format and CR will use them.  If you have leading or trailing spaces, CR removes them, but other characters, and embedded spaces, are OK.  It so happens that the multi-character strings that I've tried to use before had leading or trailing spaces, so I was thinking that multi-character strings weren't allowed in the boxes, but they are.

 However, if you want leading or trailing spaces, or an empty string, you have to use a formula.

 James
0
 
mbroad02Author Commented:
While mlmcc's answer was helpful, Jame's responses was simpler and just as effective.  Thanks!!
0
 
James0628Commented:
You're welcome.  Glad I could help.

 Both approaches have their points.  There's something to be said for using the field on the report, instead of creating a formula and using that.  The downside is that when using unusual formatting options like this, if you forget what you did, you, or someone else looking at the report, may have trouble figuring out how you got the field to look like that.  :-)

 James
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now