on 02-13-2012 6:03 PM
Dear All,
Am getting wired error in Advanced UDF.
PI getting the Input as String[] a={"01","02","03","04","05","06"}; .and its returning the output as 1 instead of 6 when i am trying to get the length of the String Array
find below sample code:
Assume that array string " b "has a value {"a","b","c","d","e","f"}
public void Sample(String[] a,String[] b,String[] c,String[] d,ResultList result,Container container)
{
HashMap y=new HashMap();
for(int i=0;i<a.lenght;i++)
y.put(""b of [ i ],""a of [ i ]);
} note : i used b of i instead actual because here its doesn't allow me to use exact one what we use in coding
i am trying to read all the value of the string array "a" to HashMap " y" for some other calculation but PI copy only the first value i.e "01"
Thanks in advance for your valuable solutions
Regards,
Manikandan
>y.put(""b of i ,""a of i );
Change into below and test
y.put(b<i>, a<i>);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI baskar,
i was trying like above but when i try to type here it was not showing properly that's why i have given the note next to the code
but now i got to know how to post the code.
y.put(b<i>, a<i>);
.
public void Sample(String[] a,String[] b,String[] c,String[] d,ResultList result,Container container)
{
HashMap y=new HashMap();
for(int i=0;i<a.lenght;i++)
y.put(""+b<i>i ,""+a<i> );
}
Hi,
Try with the code here:
Compiled successfully and seems to work well you can add System.out.println(y); at the end to verify.
Hope this helps,
Greg
Have you tried to pass to UDF all the context?
If the queue only returns one value it could be that the UDF only returns a single value or only one context value.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Iñaki Vila ,
I am passing all the context value to the UDF and the same code is executes perfectly in Eclipse and the same JRE version is used and PI version is 7.0
I required all the context value to perform the calculation but PI reads only first value of the context and getting Null pointer exception when code trying to use the second value.
I am pretty sure that we are using cache as a context and not a value so PI gets the whole context as a input
Regards,
Manikandan
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.