Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Varying # of decimal places Post Reply Post New Topic
Author Message
bal1
Groupie
Groupie


Joined: 28 Nov 2012
Online Status: Offline
Posts: 44
Quote bal1 Replybullet Topic: Varying # of decimal places
     Posted: 17 Jun 2013 at 3:36am
Hi,

Results can be of the format 123.2 or 0.124. I haven't found number formatting that will accommodate all.

If I use 3 decimals, 0.124 works but 123.200 does not - and vice versa for 1 decimal.

What number/decimal conditional formatting can I apply that will work for all cases and is dependent on the data?

Thanks!
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 17 Jun 2013 at 4:05am
Hi ,
 
As per my understanding, you want to use 3 decimals when the value is lessthan One(1) and want to use 1 decimal format when the value is Greter than One(1).. If this is the case then follow the below steps to acheive your requirement.
 
Right click on the Field and select format field > Number
select Customize button and select Formula buttor (X-2) for  Decimal Filed  and write the below logic
 
if (Database_field) > 1 then
1
else
3
 
This may help you.
 
--Praveen G
Praveen Guntuka,
praveen_guntuka@yahoo.com
IP IP Logged
bal1
Groupie
Groupie


Joined: 28 Nov 2012
Online Status: Offline
Posts: 44
Quote bal1 Replybullet Posted: 17 Jun 2013 at 4:08am
That may help...thanks.

To be clear though, I just used the one/three decimal as an example. Some data may come over as two, some data may come over as a whole number. Whatever the case may be, I need the report to accommodate the real data.

Thanks
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 17 Jun 2013 at 4:36am
Can you post some sample data and required format you need. so that we can understand your requirement easily.
Praveen Guntuka,
praveen_guntuka@yahoo.com
IP IP Logged
bal1
Groupie
Groupie


Joined: 28 Nov 2012
Online Status: Offline
Posts: 44
Quote bal1 Replybullet Posted: 17 Jun 2013 at 4:43am
Sure..just like in my original example.
Results in my database could be:
0.123
3.124
7.6
6
0.12565
etc.

I want the report to display the data exactly as it is in the database, which varies the # of decimal places.
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 18 Jun 2013 at 2:26am
Praveen Guntuka,
praveen_guntuka@yahoo.com
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 18 Jun 2013 at 2:40am
Hi

Number fields display data based on your local system number format unless you format the fields in crystal.

To address your issue, you need to write a free hand SQL and convert your number field to text and insert into your report to get original format.

After inserting if you want to insert any totals based on the field then use Tonumber().
Thanks,
Sastry
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum