cancel
Showing results for 
Search instead for 
Did you mean: 

Values Need to concatenated which occurs mutiple times for a field

Former Member
0 Kudos

Hi All,

In my Mapping i have a target fields which will occur mutiple times , i need to collect the value and concatenate it , when i write a UDF for it , i am getting a error , casue the value which is comming is not in a Array format but in string format , anyone please help me in this isssue

Thanking you

Sridhar

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sridhar,

In your mapping, you could change the context of the source node so that all value of ED1PT1 etc occur inside the context. That is, change the context which is currently occuring at each parent node to their immediate parent node.

<root>

......<details>

............<E1DPT1/> <----- Currently context is here....shift it to its parent node, which is <details>

............<E1DPT2/>

............<E1DPT3/>

This will make sure that all your values are occuring within the same context.

Now you could write a UDF logic in context or queue output where you could use a simple for loop to parse through the individual strings and concatenate them using a simple delimiter.

Later you could split the strings based on the same delimiter and use split by value to obtain each individual string if you need it

Regards,

Kshitij

Former Member
0 Kudos

I am getting error . all are existing in the same context only

Method testcase$ with 1 arguments not found in class com.sap.xi.tf._MM_RFQ_IDOCILE_IND_

where in my UDF i have written a coding for concae all the vallues

where my UDF is

String value = "";

if(a != null && a.length > 0){

for(int i=0; i<a.length;i++){

value = value + a<i> + "||";

}

value = value.substring(0,value.length()-2);

}

result.addValue(value);

Edited by: sridhar loganathan on Feb 11, 2009 8:04 AM

Former Member
0 Kudos

Sridhar, you need to declare the cache execution method as context or queue which takes multiple values as input.

Value is used to process individual input values (i.e. like a single variable) of a field for each function call.

Context and Queue are used to process multiple input values (i.e. like a string array) of a field for each function call.

Please change it and write the code according to your requirement.

Regards.

Former Member
0 Kudos

i have used Context only method only not the value but still i am not getting this one

Thanking you

Sridahr

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Would you be able to provide the source (at least simplified) and target structure?

Regards,

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Maybe you could concatenate the Strings first then use a delimiter like a pipe |, then use a string array function like .split(" I ").

Hope this helps,

Former Member
0 Kudos

Thank you for you response

But i dont know how to get the value which is occuring in a fields multiple times , actually

My structure is as follows

<E1EDPT1 >

TDID

<E1EDPT2>

TDLINE

<E1EDPT2>

TDLINE

<E1EDPT2>

TDLINE

<E1EDPT2>

<E1EDPT1>

my condition is that when TDID is a06

i Must concatenate All the TDLINE

i dont know how to do it please helpo me

Thaning you

Former Member
0 Kudos

Thank you for you response

But i dont know how to get the value which is occuring in a fields multiple times , actually

My structure is as follows

<E1EDPT1 >

TDID

<E1EDPT2>

TDLINE

<E1EDPT2>

TDLINE

<E1EDPT2>

TDLINE

<E1EDPT2>

<E1EDPT1>

my condition is that when TDID is a06

i Must concatenate All the TDLINE

i dont know how to do it please helpo me

Thaning you

Former Member
0 Kudos

Using Split value i have got all values , but my UDF is not accepting then as Array

it is givining me a error Arugment is missing

can i declare in UDF in that value as array as a[]

Thanking you

Sridahr