on 03-08-2011 2:38 PM
Hi,
My input message will look like
<customer>
<name>name</name>
</customer>
<row1>
<customer>name</customer>
<field11>111</field11>
<field12>122</field12>
</row1>
<row2>
<customer>name</customer>
<field21>211</field21>
<field22>222</field22>
</row2>
....
....
<rown>
<customer>name</customer>
<fieldn1>n11</fieldn1>
<fieldn2>n22</fieldn2>
</row1>
and i need an output like
<customer>
<name>name</name>
</customer>
<rowx>
<fieldx>111222211222.........n11n22</fieldx>
</rowx>
in short all fields from row1 to rowx need to be concatened in one big string.
What is the best way to do this?
Kr
Robert
have a UDF with input as two fields........change their context to root...........then in UDF in a for loop concat all these values to get the large string and output this UDF value to target field..............
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajeev,
I've tried to create the code for the UDF but so far i only worked some small UDF with single string as input
I suppose my UDF will have as execution type: all value of a queue
public void concatenate(String[] a, ResultList result, Container container) throws StreamTransformationException{
//what is my code?
}
So i need to know what the code is inside. Please provide some code or at least some good pointers as to how to create it.
THX
kr
Robert
Hi Robert,
Concat the field1 and field2 using standard concat function in graphical mapping.Change the context of the field1 and field2 to higher node.
mapp the target of concat to a UDF which will concat all the value in its context to a string and return that string.
UDF details :
Execution type="All values from a context"
public void myUDF(String var1[], ResultList result,Container container) throws StreamTransformationException
{
int i=0;
String resp="";
while(i<var1.length)
{
resp=resp+var1<i>;
i++;
}
result.addValue(resp);
}
map the output of the UDF to ur target field.
Hope it helps,
Anand
Surely Using UDF/ Java Mapping it is easy .
What version are u working on .
IF 7.1 , try Using Global Variable ( Graphical variable ) on receiver side.
Lets see if it worked.
try Like this
field11 -> Concat -> Graphical Variable
Graphical Variable ->
I am expecting every time value of field11 will be conactinated with previously store Graphical Variable .
Similarly for all other fields .
and in last Concate them all fields to One Output Final String.
Check this link . If you want to know the working of Graphical variable .
SAP PI 7.1 Mapping Enhancements Series: Graphical Variables.
/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
Regards
PS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.