on 04-22-2015 3:11 PM
Hi All,
I have below requirement
source structure
Node ( 0 to unbound)
Field (0 to 1) this field my come max 6 times i need to concatenate these values using delimiter @ and need to put into single target field.
guys if any one have idea please share it to me.
Thanks in advance.
Regards,
AS
Hi AS,
You can use below UDF.
Execution type: All values of context.
public void concat(String[] input, ResultList result, Container container) throws StreamTransformationException {
String output = "";
boolean first = true;
for (int i = 0; i < input.length; i++) {
if (first) {
output = output + input[i];
first = false;
} else {
output = output + "@" + input[i];
}
}
result.addValue(output);
}
Mapping is like below:
Field------->removeContexts------>UDF------>Target
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
May i know why we have to use this code. and what is the purpose
if(first){output=output+input[i];first= false;}
try to use text -> concat function multiple times to achieve the same result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.