Show decimal places in Crystal Reports

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:


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...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello DeeL9,

How is the field defined in the database?

DeeL9Author Commented:
It is stored as a NUMBER in an Oracle Database.
Have you used the Crystal format then set the number of places using a formula?

What is wrong with your method?

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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

Save and Close.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DeeL9Author Commented:
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...
Here is one way ot od it:
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?

DeeL9Author Commented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.