on 05-13-2009 3:39 AM
Hi Guys,
I have a UDF as below. How to handle the null values in the UDF? I tried a.equals("") but it is throwing errors.
int b = Integer.parseInt(a);
if(b==0) {
return "1" ; }
else if(b==104) {
return "5" ; }
else return "2" ;
any help would be appreciated.
Thanks,
Raj
Hi,
Try this: "".equals(a)
Best Regards,
Pedro Pereira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Pedro,
If i use this condition at the begining it is working fine. "".equals(a) also works fine. If i use the condition later it is always taking the b value.
if (a.equals("")) return "1";
int b = Integer.parseInt(a);
if(b==0) {
return "1"; }
else if(b==104) {
return "5" ; }
else return "2" ;
I appreciate the help for all of you.
Thanks,
Raj
Have you tried using IsNull(a) ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
I have resolved the problem by using the standard function and UDF. I will try these options as well in the UDF and i will update the thread.
Source -- If then Else -- has null value then map it to constant 1
else use the UDF to map the other values.
I will work on the above options and let you know.
Thanks a lot
Raj
try this :
if (a.length() > 0) {
int b = Integer.parseInt(a);
if(b==0) {
return "1" ; }
else if(b==104) {
return "5" ; }
} else
return "2" ;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
I tried all the variants and they r not working and i have looked at the values by displaying the queue.
I have a single value coming into the source field and the values are as below. The source field in this case dosent has any values and it is blank
---> SUPPRESS
-
> 0
-
> 0 Greyed out
any help would be appreciated
Thanks,
Raj
if null means that in the queue you find the value in suppress then your check should be ideally
a[index].equals(ResultList.SUPPRESS)
try that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried a.equals("") but it is throwing errors.
try this format if (a==null)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you tried using a.equals("").
Regards,
Chandra.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
Did you try b==null or b=="" also b==''
Please check it and see if it works.
Best Regards
Edited by: Prakash Bhatia on May 13, 2009 5:09 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
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.