on 05-16-2013 3:01 PM
Hi Experts;
I am trying to Concate multiple fields at which are on source side and send into one string at target side.
Source
<Header>Occurance 1
F1
F2
F3(Hard Coded =A)
<Header/>
<item>Occurance 0 to N
F4
F5
F6(Hard Coded =B)
F7
F8
F9(Hard Coded =C)
F10
F11
F12
F13
<item/>
Target
<Data>
I am using the below code however it's not working
String finalString = "";
int count = streng.length; // input string array count
for(int i=0;i<count;i++)
{
finalString = finalString + streng<i>;
}
result.addValue(finalString);
can anyone suggest on this.
Regards
Raja Sekhar Reddy is correct u can use standard Concat function for all source fields concat to one target field ..
if i am wrong , then u ll expalin what is exately u need on target side i mean give me one example for target structure ..
thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhay,
you can achieve this with the simple concat function available in Message mapping under text function.
i Dont know why you are going for UDF?
Refer below
In the above screen i used concat function to combine perner and amount to the target field amount.
You can find the result at the target side..
Regards
Bhargava krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhay,
please provide what you are the input parameters for the function and what you are trying to append.
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ambrish,
below is input which I want to put in single string:
{
"clientId";"Delver",
"state":"IL",
"zipcode":"60601",
"itemList":
[{partnum":"SPM11122233","sellerId":"100",":"","marketplacetype":"FBM", "mailable":"Y", "weight":"80",”qty”:”1”, “vendorcode”:””},
{partnum":"00834567901","sellerId":"",":"","marketplacetype":"DMM", "mailable":"Y","weight":"80",”qty”:”2”, “vendorcode”:””},
{partnum":"SPM22233344","sellerId":"200",":"","marketplacetype":"FBM", "mailable":"N","weight":"70",”qty”:”3”, “vendorcode”:””}
]
}
Item list Ocuurance is 0 to N . In Item list there almost 5 to 6 fields which are optional can and other 4 fields are mandatory.
I am using concate function for this but for Item list do I need to use UDF for this ..
Pls sugesst..
Regards
Hi Abhay,
Now your requirement is more clear.
you would need to work with an advanced UDF (context) where you take all the required (header fields) and Item fields as input. After you have concatenated the header fields, run a for loop on one the item field (ideally mandatory) and concatenate the value with field names as per the sequence of parameters.
finally concatenate the header values to this output and then use the resultset object for output.
If you need help with coding, let us know but I suggest to give it a try. It would be a simple code.
Ambrish
Hi Abhay - Your requirement is not clear.
If you want to concatenate multiple fields under a segment, you can use the concat function right??
if you want append multiple occurrences of a field, i.e. as item is repeating multiple times and you want to concatenate all the occurrences of field F4 then you can use below UDF.[i did not tested it.. may be you have to modify a little]
Input parameter will be F4 field and select the Queue in the Execution type..
String s;
for (int i = 0;i<=F4.length;i++)
{
s = s+F4[i];
}
result.addValue(s);
Regards,
Hareesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why dont you use standard concat function to concat?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.