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

Changing the number of decimal places in Crystal Report V10

Status
Not open for further replies.

GillinghamFC

Programmer
Jan 28, 2002
18
GB
Hi,

I'm new to Crystal Reports please help...

I have a report and want to display the number of decimal points specified from a database field, the number could potentially be different each row.

Record 1
Price PriceDecimalPointSpecifier
12.112 3
12.10 2

Any Ideas????

Thanks in advance

Glenn

 
I think you can right click on {table.price}->format field->numbers->customize->decimals->x+2 and enter:

{table.PriceDecimalPointSpecifier}

That would format the price wiht the number of decimals indicated in your specifier field. Is that what you mean? Or were you trying to count the number of decimal places to the right of the "." ?

-LB
 
Try:

len(mid(totext({table.price},0,""),instr(totext({table.price},0,""),".")+1))

This should return the number of decimal places.

There are other means, but since you didn't share anything technical, I didn't simplify.

In general share:

Crystal version
Database/connectivity
Example data
Expected output

-k
 
Thanks for your response...

I am using Crystal Reports 10 developers edition is Visual Studio .net and connection to the via ADO.net Databaset.

I have added your formula to decimal and/or rounding yet it only seems to return two decimals places all the time despite certain number contain up to 4 decimal places.

Current Output

22.01
20.13

Desired Ouput

22.01
20.127

Thanks


 
Looks like totext got me again, test:

len(mid(cstr("77.001"),instr(cstr("77.001"),".")+1))

-k
 
If you already have a field that specifies the number of decimals, as you showed above and as you indicated in your post in another forum, all you need to do is add that field {table.PriceDecimalPointSpecifier} to the formula area for decimals, as I indicated earlier.

-LB

 
hi glenn,
did u solve this. if so can u share that with me.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top