cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert exponential format to Decimal number format in PI?

Former Member
0 Kudos

Hi All,

I need to convert exponential format to Decimal number format in PI 7.0, Kindly suggest me.

Regards,

Manikandan

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184681
Active Contributor
0 Kudos

Hi,

You need a simple UDF for that purpose:

BigDecimal myNumber = new BigDecimal(input);

double myDouble = myNumber.doubleValue();

return myDouble;

This is for Execution Type = Single Values and a single input parameter called simply input. Then you simply develop the mapping as source -> UDF -> target, where source is an exponential number and target is a "normal" decimal number.

Hope this helps,

Greg

former_member184789
Active Contributor
0 Kudos

Hi Greg, I also have a similar requirement and I may get the source field as 2.1E5 or even as 7.88327. I need to convert the exponential values as 21000000 and should pass values such as 7.88327 as it is. I cannot use formatNumber as the no. of decimal points are not fixed and I don't want any redundant zeroes because of formatNumber...The above code does not compile and gives error cannot find symbol pointing towards Bigdecimal...

baskar_gopalakrishnan2
Active Contributor
0 Kudos

you might have to use import statement for BigDecimal... See your thread over there...

former_member184681
Active Contributor
0 Kudos

Hi,

Check my reply in your own thread . You won't output any redundant zeros if you use hash mark "#" in the format definition, instead of zero, just like I did.

Regards,

Greg