cancel
Showing results for 
Search instead for 
Did you mean: 

Exponential to Decimal Value conversion in MII v12.0

Former Member
0 Kudos

I am trying to convert exponential '2.3100000000000000E+02' value to decimal number in MII.

Is there any predefined function in MII which I can use for this conversion?

any help is appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Try this:

exp("2.3100000000000000E+02")

Former Member
0 Kudos

I have tried this, it gives me a different value... the expected decimal value is 231.

Former Member
0 Kudos

Srinivas,

you need to delete the "+" and using the function number(). For example:

number(stringreplace("2.3100000000000000E+02","+",""))

Regards

Pedro

Former Member
0 Kudos

Hi

I tried like this:

number(format("2.3100000000000000E+02" ,0.00))*100

It is giving 231.But i am not sure like this we can use.

Former Member
0 Kudos

No Manisha, you are getting 231 there by multiplying it by 100, that should now be the case.

In 2.3100000000000000E+02, the BASE is 2.3100000000000000 and EXPONENT is 2,

= 2.31 * 10^2 = 231.

I also tried doing this manually number(stringleft( "2.3100000000000000E02" , 18 )) * 10^ number(stringright( "2.3100000000000000E02" , 3 )) This works fine but when I try passing this value at run time dynamically I get an error with stringright saying - index out of range

number(stringleft( ForEachRecord.Output(/Row/Name) , 18 )) * 10^ number(stringright( ForEachRecord.Output(/Row/Name) , 3 ))

This throws an error only stringright function.

agentry_src
Active Contributor
0 Kudos

Srinivas,

Why do you need to do this conversion? Is it showing up in a grid incorrectly?

Regards,

Mike

Former Member
0 Kudos

Hi Pedro,

But what if the value I get is 2.3100000000000000E-02, i.e., with minus which is quite possible

Former Member
0 Kudos

Its a client requirement and should be converted even before inserting it into MES.

Former Member
0 Kudos

Srinivas,

"E-" will work correctly in the function number("2.310000E-02"). It is only the "E+" that makes

problems in the funciton number. Try yourself with the example above and you will see the

success.

Regards.

Pedro

Former Member
0 Kudos

Yes, that indeed works. Thank you very much Pedru

agentry_src
Active Contributor
0 Kudos

Srinivas (and Pedro),

I see that it is now closed, but since I put the script together, I will post it anyway.

First do a conditional block with Input1 = stringindexof(Transaction.TestNumber, "E") to determine if the input is in scientific notation. If it is in scientific notation, convert to number format using:

number(stringleft(Transaction.TestNumber,stringindexof(Transaction.TestNumber, "E") - 1)) * (10 ^ number((stringpart(Transaction.TestNumber, (stringindexof(Transaction.TestNumber, "E") + 1), stringlength(Transaction.TestNumber) - stringindexof(Transaction.TestNumber, "E")))

Otherwise simply use the number as is.

NOTE: in 12.1 scientific notation is interpreted as a number, not a string.

Best Regards,

Mike

Answers (0)