Posted by: R Manimaran | February 23, 2011

Crystal Report: Formatting the Decimal Field Custom Styling

Crystal Report: Formatting the Decimal Field

Even though I am currently working in SharePoint I still have a fond of working in crystal reports. Recently in the MSDN forums I saw a requirement in Crystal Report forums section. The requirement is that there is a decimal type column in the SQL Server Database as Shown below.

When we connect the DB in the crystal report, we got the output like this.

But the output should show something like; if the Decimal Field value has no decimal value then it should show as integer without decimal places. If the Decimal Field value contains some decimal value data then it should be left as it is.

Solution:

In the Crystal Report, Right Click the Decimal Field we have placed in the Detail section and select Format Object.

In the Format Editor window select Custom Style under Style and click Customize button.

In the opening popup window select Number tab and click the Formula Editor Button next to Decimals:

Enter the formula as shown.

Click Save and Close in the Formula editor and click Ok in Custom Style window

Now the Output in the Crystal Report is come as Expected.

About these ads

Responses

  1. Thanks a billion!!! Worked wonders!!!

  2. Great post, and saved me time! Thanks v much… J

  3. I can’t believe how simple this was, saved me banging my head through the wall!

  4. thanks man,.

  5. Thanks dude.I like the simple logic you used


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

Join 25 other followers

%d bloggers like this: