Sunday, February 26, 2012

Format Help

i'm trying to format integers to have ,s... like 1,000 instead of 1000.
??????You want commas in your database? Don't you only want the commas in your application (front-end)?|||Output formatting really ought to be done on the client side, for a number of reasons.

First and foremost, if you format the data at the server you create a logistical nightmare if/when you need to expand to support multiple locales. You'll have to write code everywhere you do formatting to determine how the data needs to be formatted for each case. This is an exercise in quick ways to create code that will drive your insane at some later date.

From a pure performance basis, it is a poor choice to format your data before you need to. The formatting will inhibit you from being able to do any additional processing. It is really hard to add a 7.5% VAT to "$1,000.00" in the United Kingdom, while it is trivial to add the VAT to the unformatted monetary value which will also format correctly when it reaches the client!

-PatP|||what i'm trying to do is write a select statement that would add the ,s in...

is that possible??|||Nearly anything is possible. I'm pretty sure that it isn't a good idea. I would very strongly advise that you do your formatting on the client side, using a tool such as Crystal Reports, MS-Access, VB, etc instead of formatting the data on the server.

-PatP

No comments:

Post a Comment