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

Crystal rounding off number field

Status
Not open for further replies.

djeddie

IS-IT--Management
Jun 1, 2003
38
AU
Hey All,

Got abit of an issue with the way that Crystal displays the contents of a field. I'm using v9.0 and reading off a DB2 database. The field in question holds a unique number with is 20 numbers in length. When this field is viewed from the DB2 administration program the field displays correctly and when i run a MS-Access query on the table it also displays the field correctly but when i drag the field into the details area of a report it round the number up to the nearest hundred.

Here's an example

Correct Field Content - 41378249203235657

How Crystal displays it - 41378249203235700

Why is this happening??

Cheers

Eddie S
 
Crystal can handle a maximum of 15 digit numbers. Its a limitation of the software. I don't know about v10 and XI.

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Is this a code number? If so, turn it into a string; ToText({your.number}). That should be OK.

If you need to do calculations, that is trickier. You might divide it into two, part for the high-order, obtained by dividing by a few million, and the rest by truncation. But Crystal's not the best software tool for that.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hey Madawc,

Thanks for the tip but it didnt work.

I created a formula containing ToText({CALLCON.CONNID}) and it didnt work. It actually displayed the field like this:

41378249203235700.00

Do you think i could add a SQL command to convert the number field to text instead of using a formula?

If so, can someone please give me a hand at writing the SQL command to convert the field from number to text?

Cheers!!!!!!
 
Try a SQL expression like:

{fn CONVERT(CALLCON.`CONNID`,SQL_VARCHAR)}

You might have to adapt this depending upon your database and connectivity, but this worked when I tested it on the Xtreme database.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top