cancel
Showing results for 
Search instead for 
Did you mean: 

graphical mapping splitting

Former Member
0 Kudos

Hi ,

I have a mapping problem where i need to split the source field by comma into 2 seperate target fields.

For eg. Source = 123 main Street , 455 , app1

I need this to be split by comma to target1 = 455 and target2 = app1.

Please advice.

Thanks,

Teresa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Teresa

You need to use an UDF. With two parameters one for input and the other for position.



 String valSplit[] = input.split(",");
 int position = Integer.parseInt(Pos);
 
 return valSplit[position].toString();

source----


>

...................................UDF----


>Target

constant(position)------>

Regards.

Luis Ortiz

Former Member
0 Kudos

Hi Luis,

Thanks. I created the UDF but i do not have any input node. The output of the UDF is mapped to target.

I have created two parameters one for input and one for position.

so if source is 123 main street , 555 , 222

How will i be able to put 555 in target1 and 222 in target2 ?

Thanks,

Teresa

Former Member
0 Kudos

Hi Teresa

I created the UDF but i do not have any input node.

is your source like this : 123 main street , 555 , 222 ? the input is only a generic name.

So you need to use the like this

Source -


>

1 (constant)--


>UDF----Target1

Source -


>

2 (constant)--


>UDF----Target2

Regards

Former Member
0 Kudos

Yes i am using like that but getting the following error below during activation.

Message Mapping: MM_Ecc6 | http://test.com:

Starting compilation

Source text of object Message Mapping: MM_Ecc6 | http://test.com has syntax errors:

Function Split, Line 1:

cannot find symbol symbol : method split(java.lang.String) location: class com.sap.aii.mapping.api.TransformationInput String valSplit[] = input.split(","); ^

Function Split, Line 2:

cannot find symbol symbol : variable Pos location: class com.sap.xi.tf._MM_Ecc6 int position = Integer.parseInt(Pos);

Former Member
0 Kudos

Hi Teresa.

Did you check if your put the correct parameters for the UDF . Check the names of parameters as the code.

Regards.

Former Member
0 Kudos

Thanks Luis. It worked.

Answers (0)