cancel
Showing results for 
Search instead for 
Did you mean: 

How to concat one element with 0..4 occurence?

Former Member
0 Kudos

Hello! I need to concat occurences of one element to one element like this

<a>

<element>1</element>

<element>2</element>

<element>3</element>

<element>4</element>

</a>

to:

<b>

<elementB>1234</elementB>

</b>

How can I do this? Occurence of element is 0..4

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

You need to use UDF for this. UDF type is of context type

argument is input


StringBuffer sb = new StringBuffer("");
for(int a=0;a<input.length;a++){
 sb = sb.append(input[a]);
}
result.addValue(sb.toString());

Mapping logic is like this:


element --> removeContext --> UDF --> target

Hope this helps,

Mark

Former Member
0 Kudos

Thank you very very much!

Former Member
0 Kudos

Hello! I have some errors while executing this UDF:

Function Concat_city, Line 2: 
cannot find symbol symbol  : variable length location: class com.sap.aii.mapping.api.TransformationInput for(int a=0;a<input.length;a++){                    ^
Function Concat_city, Line 3: 
array required, but com.sap.aii.mapping.api.TransformationInput found  sb = sb.append(input[a]);

Note: /usr/sap/SPD/DVEBMGS22/j2ee/cluster/server0/./temp/classpath_resolver/Map8aa9d039226b11e1869e00000d43ca76/source/com/sap/xi/tf/_MM_Delvry_2_OrderImport_line_old_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /usr/sap/SPD/DVEBMGS22/j2ee/cluster/server0/./temp/classpath_resolver/Map8aa9d039226b11e1869e00000d43ca76/source/com/sap/xi/tf/_MM_Delvry_2_OrderImport_line_old_.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors

What does it means?

Edited by: Andrey Bolshakov on Dec 9, 2011 2:44 PM

Sorry, I forgot about input parameter

Edited by: Andrey Bolshakov on Dec 9, 2011 2:49 PM

Former Member
0 Kudos

Hi andrey

Can you tell me what inputs you gave?

the name of the argument must be "input". The udf needs to be of type context type.

regards

Ramesh

Edited by: Ramesh P on Dec 9, 2011 7:30 PM

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

Specify the execution type of UDF as "All Values of Queue or All values of Context"

Regards,

Priyanka

Answers (0)