cancel
Showing results for 
Search instead for 
Did you mean: 

removing decimal in mapping

Former Member
0 Kudos

Hi,

How do I remove decimal from float (source) to unsigned integer (target) in graphical mapping?

For eg:

Source = 1500.23

Target = 150023

Reg,

Shobhit

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
Former Member
0 Kudos

Replace string worked!!

henrique_pinto
Active Contributor
0 Kudos

If you want a quick way of just letting numbers to pass, use:

...
return a.replaceAll([^0-9], "");
...

in a UDF.

Regards,

Henrique.

rxdash
Explorer
0 Kudos

This did not work. I tried

a.replaceAll("[^0-9]+","");

it worked.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi-

Here you need to use a User defined function.

I think the one that is given by Jai Shankar is incorrect.

By using replace string we need to replace the . with some other thing like (,) and i think this want work.

Let me check if i can find the solution for this.

Former Member
0 Kudos

You need an UDF.

 int result;
float input = Float.parseFloat(a);
result = (int)input;
return (result+"");

This UDF takes one input the float value.

Regards,

Jai Shankar

prabhu_s2
Active Contributor
0 Kudos

<b>Source = 1500.23

Target = 150023</b>

reading from this case multiply soruce with 10 and then use fornum or formatnum f/n....hope this shud work

Message was edited by:

Prabhu S