Monday, April 2, 2012

Crystal Reports : Data Conversion (Numbers and Text)

Anyone who's spent some time with Crystal Reports surely knows the value of converting between data types, especially when your back-end database isn't using the types we'd like. (If you've ever tried to summarize a string field you know what I'm talking about!)

Enter in the heroic TOTEXT() Crystal function. Passing a value to this function will return the numeric equivalent.

Examples;

TOTEXT(123.45) returns "123.45"

TOTEXT(000045) returns "45"

You'll notice that ToText drops any leading zeroes, but maintains the decimal precision.

To go the Other Way (from Text to Numeric), simply use the TONUMBER() function, like this;

TONUMBER("123.45") returns 123.45

TONUMBER("$123.45") returns 123.45

TONUMBER("Cost: $123.45") returns an Error, as the source value must be "like a" Number

Of course, all formatting issues aside, the real reason we want to convert is usually to allow for easy summaries (i.e. running totals) or to "cut out" portions of a number as a string.

3 comments:

buy Chanel bag said...

Although no date was given in the catalog, it appears to be an earlier design. And, as an aside while Hermes is being discussed, we cannot continue without mentioning fashion scarves.

Libin Huang said...

20160427libinhermes belt
michael kors handbags
reebok shoes
cheap jordans
michael kors uk outlet
true religion jeans
fitflops sale
true religion jeans
hermes outlet store
celine outlet online
police sunglasses
mulberry outlet
michael kors handbags
ralph lauren outlet
coach factory outlet
coach outlet
cheap ray ban sunglasses
polo ralph lauren
cartier sunglasses
bottega veneta outlet
true religion outlet
tiffany and co
cheap oakley sunglasses
ray-ban sunglasses
oakley sunglasses
ralph lauren outlet
michael kors handbags
tory burch shoes
beats by dre
michael kors outlet online
tory burch outlet online
lululemon outlet online
oakley sunglasses
oakley sunglasses wholesale
true religion jeans

Fangyaya said...

retro jordan shoes
oakley sunglasses wholesale
michael kors outlet online
the north face outlet
cheap jordan shoes
true religion outlet online
jordan 11
christian louboutin shoes
louis vuitton paris
cheap jordans
michael kors outlet clearance
adidas yeezy
coach factory outlet online
gucci outlet online
tory burch flats
jordan retro 13
air jordan shoes
uggs on sale
nike trainers uk
burberry handbags
coach outlet store online
jordan concords
burberry scarf
louis vuitton purses
christian louboutin pas cher
michael kors outlet
curry 3
ralph lauren polo
longchamp outlet
cheap uggs
christian louboutin wedges
adidas nmd
new york knicks jerseys
kate spade outlet
kobe shoes
fitflop sale
kd 7 shoes
coach factory outlet
kate spade
adidas yeezy
20168.13chenjinyan