cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.0

Former Member
0 Kudos

Hi All,

Is there any node function for converting the string to number?

Do I need to write the UDF for that ?If so,then please provide me the UDF for that.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

There is no standard function. Write a UDF

MyNumber = Integer.parseInt(MyString);

Regards,

Prateek

Former Member
0 Kudos

Hi Prateek,

Thanks for the reply.

Can you please provide me the UDF?

Thanks in advance

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Swetha,

Prateek alredy provided pice of statemet to be used to convert string to Integer.

try with the same

Regards,

Raj

prateek
Active Contributor
0 Kudos

I have written a line of code which should be enough to perform the conversion. The process of writing UDF should be searched on SDN.

Regards,

Prateek

Former Member
0 Kudos

Hi,

I have used this UDF for converting string to integer, use this according to ur requirement:

Input Variable = String input

input=input.replaceAll(" ","");

// checking for null or spaces,if found return 0

if ((input.length() == 0) || ( input == "") )

return ""+0;

else{

Integer x = new Integer(input);

return x.toString();

}

Thanks

Amit

Former Member
0 Kudos

Hi Amit,

Thanks for the reply.

Can you Please tell me how many arguments do I need to put for this UDF?

Also,which button needs to be clicked Value/Contect/Queue?

Thanks in advance

rajasekhar_reddy14
Active Contributor
0 Kudos

as prateek mentioned search in sdn for to know how to write UDF... there are many documents available on the same topic if you read those documents in future it will help you to write UDF easily.

pass one argument , select value,

there is concept when we seelct value , context and queue...

feel free to seach in sdn..

Regards,

Raj

Former Member
0 Kudos

hI,

U choose execution type as : Single value

Pass 1 argumnet as input.

Name that argument as "input"(as mentioned in the code).

Thanks

Amit

prateek
Active Contributor
0 Kudos

Shweta, this is too basic question. You should search it on SDN instead of asking. If your initial doubt is solved, you should close the thread.

Regards,

Prateek

Former Member
0 Kudos

Hi Amit,

I have used this UDF in the mapping but the error comes as the processing log with no logs.

Can you please help me?

Thanks in advance

Former Member
0 Kudos

Hi Shweta,

Create simple type UDF and input parameter is one, give that name (Ex: Str, so you need to give only one input value and you will get one output value)

write this code

return Integer.parseInt(Str);

Check this links about the all types of UDFs

http://help.sap.com/saphelp_nw04/helpdata/en/b1/83a09f668320419dbe00a741e0fe6a/frameset.htm

/people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

/people/venkat.donela/blog/2005/06/09/introduction-to-queues-in-message-mapping

Regards

Ramesh

Answers (1)

Answers (1)

Former Member
0 Kudos

answered