cancel
Showing results for 
Search instead for 
Did you mean: 

Check if node exist in User-Defined Java Map

Former Member
0 Kudos

Does anyone know the correct Java syntax for checking if a node exist. I know I can check for a value being empty with if (strVal.equals("")) but I want to see if the node exist for the value coming into the User-Defined function. I basically want to dupliate the existing function called "Exists" inside a User_Defined function.

Accepted Solutions (1)

Accepted Solutions (1)

former_member206604
Active Contributor
0 Kudos

Hi,

You can check like strVal.equals(null).

Thanks,

Prakash

Former Member
0 Kudos

Hi Prakash,

I tried this but it appears that if I map a element into a UD function, regardless of the code inside, if the mapped node does not exist then it suppresses all outputs. I want to feed a value into the UD and if the node exist do one thing else do something else.

Thanks for the help.

Regards,

Joe

former_member206604
Active Contributor
0 Kudos

Hi,

How many input you are passing to the UDF? Is it only one?

Thanks,

Prakash

henrique_pinto
Active Contributor
0 Kudos

If you use Advanced UDF, you could compare the field to ResultList.SUPPRESS.

Regards,

Henrique.

Former Member
0 Kudos

Prakash,

I am passing two values into the UDF. One is the value which could be null and the other is the value to concatinate if the node exist.

Regards,

Joe

former_member206604
Active Contributor
0 Kudos

Hi,

Are you looking for the follwing two possibilites.

if(a.equals(null))

return b;

else

return (a + b);

OR

if(a.equals(null))

return "";

else

return (a + b);

This should work for sure.

Are you sure the otehr value b is always not null that is the node always exist.

thanks,

Prakash

Former Member
0 Kudos

Not sure what I was doing before but this worked perfect. Thank you.

if(a.equals(null))

return "";

else

return (b + a);

Answers (0)