Crystal Reports Formula: Get Decimal and Non Decimal Parts

For example, I have a value of 103.33. I want to put 100 on one variable and 33 on another variable. How can i do this?

Thanks.

+3
source share
3 answers

Create two formula fields, for example, the integer and decimal parts.

The formula for allpart is trunc ({yourfieldnamehere}), and the formula for decimalpart is {yourfieldnamehere} is trunc ({yourfieldnamehere))

The value you get in the decimal part will be a decimal fraction; if you know that this will always be a two-digit decimal, multiply by 100. If it is a variable, you can do a quick string conversion, count the numbers and multiply by the corresponding power of 10.

Hampk

+4

trunc , , . ToText, Split, "."

ToText Split, "."

+3

You can also use the Stay function to find the number after the decimal point. For example, REMAINDER ({FIELD NAME}, 1) should give you 0.33

0
source

All Articles