[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Show decimal places in Crystal Reports

Posted on 2004-11-22
8
Medium Priority
?
3,264 Views
Last Modified: 2010-05-18
I'm using Crystal Reports 8.5
I have a number field that can have a varying # of decimal places.
For example the field could be:

1.234567
1.2345
123.4567

The maximum a # could be is: 999.999999 it can never be 1000.

In reality the # of decimal places can vary to be any #...

I want to show 6 decimal places.
If there are not 6 decimal places I want to show only 4.
I could make the data in the database have only 6 or 4 decimal places if that could help in a solution.

I have a formula that I thought would do it, but unfortunately I can't format the maximum #, the formula becomes invalid for that 6th decimal point, it only works till 5 decimal points, and I'm not quite sure why...
0
Comment
Question by:DeeL9
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 12646574
Hello DeeL9,

How is the field defined in the database?

Pete
0
 

Author Comment

by:DeeL9
ID: 12646636
It is stored as a NUMBER in an Oracle Database.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 12646694
Have you used the Crystal format then set the number of places using a formula?

What is wrong with your method?

mlmcc
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
LVL 28

Accepted Solution

by:
bdreed35 earned 375 total points
ID: 12646740
SO you want to determine the number of decimal places that exist in a number in that database field and then force either 4 or 6 places to be displayed?

Add that database field to the report.
Right click the field and choose Format Field.
Click the number tab, then the Customize button.
Click the X+2 button to the right of Decimals.
In the editor, you can use a formula like this:

if int({table.field}*10000) = {table.field}*10000 then
    4
else
    6

Save and Close.
0
 

Author Comment

by:DeeL9
ID: 12646741
Describe what you mean?
Format it to what and use what formula?

Essentially if the # in the database is 123.4567 i want it to display 123.4567
If the # is 123.456789, I want to show 123.456789.
If the # is 1.2 I want it to show as 1.2.
If the # is 1.234001 I want to show 1.234001... etc.

toText doesn't work, because it rounds...
0
 
LVL 28

Expert Comment

by:bdreed35
ID: 12646963
Here is one way ot od it:

http://www.kenhamady.com/form15.html
0
 
LVL 77

Expert Comment

by:peter57r
ID: 12646998
Quote from original Q.
"I want to show 6 decimal places.
If there are not 6 decimal places I want to show only 4."

Have the rules changed?

Pete
0
 

Author Comment

by:DeeL9
ID: 12647043
No they have not, I'm in the process of testing.
Though, I think I will up the points because I may have another question.
I think bdreed's way is working.

I'll get back.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Integration Management Part 2

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question