cancel
Showing results for 
Search instead for 
Did you mean: 

How to print only the decimal points in crystal reports

KennedyT21
Active Contributor
0 Kudos

Dear Experts.

Suppose if i have a value 2658.656  how i can print only 656. in the Crystal reports.

Rgds

View Entire Topic
abhilash_kumar
Active Contributor
0 Kudos

Hi Kennedy,

Create a formula with this code:

numbervar x := {number field};

x- Int(x);

This should give you the decimal number in this format:

0.656

-Abhilash

KennedyT21
Active Contributor
0 Kudos

Hi Abhilash,

Thanks for you reply. but i need only 656 how to remove the 0. from it. am Struck there only.

Thanks in advance,

former_member203168
Active Participant
0 Kudos

Hi Kennedy,

Use below formula to display only 656 from your field.

Split(Totext(Database_Field),".")[2]

--Praveen G

KennedyT21
Active Contributor
0 Kudos

Hi Praveen,

It is working fine, but if the value is 2565.350 then it is printing 35  i need 350 is it possible...

Rgds

abhilash_kumar
Active Contributor
0 Kudos

If you're not sure about how many decimals there could be, use this code:

numbervar x := {number_field};

strreverse(totext(tonumber(strreverse(split(totext(x,6),'.')[2])),'#')); //This takes into account upto 6 decimal places.

-Abhilash

KennedyT21
Active Contributor
0 Kudos

Hi Abhi...

I will have 3 decimals. but suppose if the value ends with 0 (2560.350 ) then it should print 350

hope you are clear now, the above given is printing only 35.

Thanks,

Kennedy -

abhilash_kumar
Active Contributor
0 Kudos

In that case this should work:

Split(Totext({number field},3),".")[2]


-Abhilash

KennedyT21
Active Contributor
0 Kudos

Thank you...

Cheers!!!