Skip to Content
0

How to convert .10 number to whole number in crystal report

Oct 28, 2016 at 01:12 PM

233

avatar image

Hello Experts!

I would like to insert a field in crystal report that will be converted to a whole number. It comes from a UDF from the OCRD (Business Partner Master Data). The values are decimal , most values that will be entered to that UDF is .10, .20 and .30.

When inserting this field to the crystal report, I want it to appear as a whole number. I plan to create a formula field but I'm not sure what formula to use cause I'm new to SQL etc. :) Or can you suggest another option where I can convert the decimal value from SAP to a whole number in Crystal report?

Thanks!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

DIEGO LOTHER Oct 28, 2016 at 01:33 PM
2

Hi Nikka,

You can format your number inside crystal, without formula.

First right click on your field in crystal and choose the option "format field", after this, a new screen will be opened. After this follow the steps on the images.

Hope it helps.

Kind Regards,

Diego Lother


img1.png (20.7 kB)
img2.png (32.8 kB)
Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hi Sir Lother,

Thanks for replying to y question again.

I can't seem to find the option of changing the number format when I click the format editor. Does it have something to do with my Crsytal report version or something?

Thanks again :).

4.jpg (244.4 kB)
0
Nikka Paula Castillo

Hi Nikka,

This occurs because your sql query of your report returns the value in a varchar type.

You need convert your field in your query. You do something like this in your sql:

CAST(yourField AS INT) for int type

CAST(yourField AS Numeric(10,6)) for decimal type

Hope it helps,

Diego Lother

0

Hi Nikka,

I hadn't understood all the context. But I if understand now, your udf field is a varchar field and have a "." in the begin. If yes, the way is the following, you can do this in your sql:

CAST(REPLACE(yourField, ',' '') AS INT)

But if your field is type float like 0.10, 0.20.

You can follow the suggestion below in Smith's answer and in your sql do this:

CAST((yourField * 100) AS INT)

or

yourField * 100

and follow my first answer how to configure numeric field in crystal report.

Hope it helps.

Kind Regards,

Diego Lother

0
Dick Smith Oct 29, 2016 at 03:27 AM
0

why not *100

Share
10 |10000 characters needed characters left characters exceeded