on 2006 Jun 29 4:45 PM
Hi,
In my scenario i need to build a UDF for the next structure:
-> Product Code
---> Atribute Code
---> Atribute Value
For each ocurrence of Product Code could occurs n of (Atribute Code + Atribute Value) and as a target i should map this to a string as show in the example:
-> PC - AAA
---> AC - 001
---> AV - QWE
---> AC - 002
---> AV - 12,9
-> PC - BBB
-> PC - CCC
---> AC - 002
---> AV - ZXC
So my target string should remain like this:
AAA;001;QWE;002;12,9|BBB|CCC;002;ZXC|
Can anyone provide me any help regarding the constrution of UDF, as i'm not an expert in java code ...
Thanks in advance,
JMMatos
Why you want to write a UDF, you can achieve this with the concat function.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, it is not possible with concat, as you want to merge values from the same node and different contexts.
To solve the problem I have defined two UDFs.
The first function merges the values belonging to the same context. Create a function and set the cache to <i>Context</i>.
public void func1(String[] PC,String[] AC,String[] AV,ResultList result,Container container){
String output = PC[0];
for (int k=0;k<AC.length;k++)
output = output + ";" + AC[k] + ";" + AV[k];
result.addValue(output);
}
The second function merges the values from different contexts. Create a function and set the cache to <i>Queue</i>.
public void func2(String[] a,ResultList result,Container container){
String output = "";
for(int k=0;k<a.length;k++)
output = output + a[k] + "|";
result.addValue(output);
}
Combine the tags like this:
PC
AC - func1 - removeContexts - func2 - target
AV /
Regards
Stefan
Hi Stefan,
Thanks for your help ...
I've implemented the UDF's as you told me but my structure is a little more complex as i've mentioned before ...
I have a Node1 and my PC above ...
-> Node1
---> PC
Next above PC i have another Node ...
-> Node1
---> PC
-
> Node2
-
> AC
-
> AV
Does it seem to u that those UDF that u have mentioned could be able to work with this structure ?!?!?
Thanks again,
Regards,
JMMatos
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
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.