on 03-26-2012 10:33 AM
Hi
I have written a udf cod for checking the condition i have tested the code in eclipse it is working fine but when i put the same code and test in pi
it not giving expected result
It is not evaluation the below condition in pi ( if (a.equals("F") && (b != ("03"))))
String a = "F";
String b = "4";
String c= "";
System.out.println(a);
System.out.println(b);
if (a.equals("F") && (b != ("03")))
{
c="test";
System.out.println(c);
}
else if(a.equals("F") && (b.equals("03")))
{System.out.println("PMI");}
else if (a.equals("E"))
{
System.out.println("FAB");
}
else if (a.equals("X"))
{
System.out.println("MIX");
}
else
{
System.out.println("NA");
}
}}
Any suggestions
Thanks
Sankar
Hi Sankar,
Simply replace each occurrence of System.out.println("SOMETHING") with result.addValue("SOMETHING") and it should work as expected.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Clarifying your questions.
System.out.println is used to write the output on the console ie. input output device. So you use in the eclipse to show the values during runtime. Similary in UDF you can write the output as log traces as mentioned on the above reply.
If you want to provide the output of the UDF to the target, you need to add to the ResultList object. In UDF we reference the ResultList class with result instance variable.
result.addValue("values that needs to be added");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
System.out.println wil not work in UDF's.
try the below code which will add the message in the log:
container.getTrace().addInfo("your message");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.