Wednesday, May 25, 2011

Crystal Reports : Converting Numerical Values to Currency Values

In any aging or "invoice" report, you will undoubtedly need to sum up some dollar amounts.
This can be tricky, depending on how the back end database is storing the data.

In a perfect world, you are using SQL server and the dollar amount field is declared as CURRENCY.

In the real world, however, the value may be stored at plaintext, which as we all know, cannot be summarized as a numerical value.

Now, we can convert the plaintext INVOICES.AMOUNT into a number by using TONUMBER(INVOICES.AMOUNT).

A better solution might be to use the TOCURRENCY() function, which will not only convert our plaintext to a numerical value, it will also provide the expected number of decimal places, and also display itself with the currency symbol ($).

Just a quick shortcut. You could do the same thing with a combination of the TONUMBER() function and field formatting. I've found that when dealing with dollar amounts, CURRENCY is always preferable to NUMERIC.

1 comment:

Benny said...

Particularly really fake hublot a call is actually the very first time the actual exhibit provides the "master craft" display, the actual target audience may benefit from the picture tag heuer replica enamel (the actual fill up teeth enamel, filigree teeth enamel, black and white rolex replica uk teeth enamel, semi-hollow teeth enamel), jade alleviation such as, hay as well as flower marquetry, mosaic, steel drops along with other rolex replica sale build. It's documented which, "Cartier replica Period Art" exhibit may available to the general public tag heuer replica sale in order to March. 12. This year, the driver ambitious, the choice is clear. rolex replica classic. In this new version of the stunning elation modern, I went through a major update. Suit actor was a white face new version, please wear a blue stripe red rolex replica drive, white and classic Le Mans 1970 film excellent. The Porsche 917 Gulf driving scenes of his, in tag heuer replica watches, real estate department insisted on giving Joe Siffert including a driving replica tag heuer watches chronograph suits overall also natural to him.