on 09-08-2010 6:37 AM
Hi I am Passing this value as input
<input>GROUP1,CODE1,DESC1;GROUP2,CODE2,DESC2;GROUP3,CODE3,DESC3</input>
I need to get output as
<A>
<ABC>
<el1>GROUP1</el1>
<el2>CODE1</el2>
<el3>DESC1</el3>
</ABC>
<ABC>
<el1>GROUP2</el1>
<el2>CODE2</el2>
<el3>DESC2</el3>
</ABC>
<ABC>
<el1>GROUP3</el1>
<el2>CODE3</el2>
<el3>DESC3</el3>
</ABC>
</A>
Please guid me how to proceed
Regards
Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krishna,
I've a solution, which expects exact one input string.
For the node ABC use the following UDF (ExecutionType: All Values of a Context; 1 argument):
String[] values = var1[0].split(";");
for (int i = 0; i < values.length; i++) {
result.addValue("");
}
For the other nodes (el1, el2, el3) use the following UDF (ExecutionType: All Values of a Context; 2 arguments):
String[] values1 = var1[0].split(";");
int pos = Integer.parseInt(var2[0]);
for (int i = 0; i < values1.length; i++) {
String[] values2 = values1<i>.split(",");
result.addValue(values2[pos]);
result.addContextChange();
}
Use the following constants as second argument:
el1 -> 0
el2 -> 1
el3 -> 2
Regards,
Juergen
Edited by: Juergen Grallert on Sep 8, 2010 1:29 PM
Use this UDF to solve your problem..
Create UDF with context as Queue and declare the input variable as 'a'.
String[] outstr1 = a[0].split(";");
for (int i = 0; i < outstr1.length; i++)
{
String[] outstr2 = outstr1<i>.split(",");
for (int j = 0; j < outstr2.length; j++)
{
result.addValue(outstr2[j]);
}
result.addValue(ResultList.CC);
}
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.