Strange Java snippet behavior

Hi All,

I have a column with integers, but the integer is not there for all the records (sometimes it's empty, i.e. "?" in the table). When the integer is not specified, there is an indicator column that says "YES", whereas the other records that do have the integer column occupied have "NO". When I have this code in the java snippet:

if ($new column$.equals("YES")) {

            rank = 1000;

} else if ($new column$.equals("NO")) {

            rank =999;

}

return rank;

Things behave as expected. However, when I do this:

if ($new column$.equals("YES")) {

            rank = 1000;

} else if ($new column$.equals("NO")) {

            rank = $Rank$;

}

return rank;

Then the new column that should say "1000" when the YES is present in the row, now is undefined, i.e. "?". For the "NO" rows, it again behaves as expected, where the new column is essentially a copy of the existing column.

Am I missing something here?

Thanks,

Natasja

 
 
if ($new column$.equals("YES")) {
 
rank = 1000;
 
 
} else if ($new column$.equals("NO")) {
rank = $POC Rank$;
 
}
 
return rank;

Hi Natasja,

There is a checkbox "Insert Missing As Null" that assign a null value to the internal fields if the input is missing. That should do the trick?

If this checkbox is not set (which is the default), then the output will be missing as soon as one of the used fields in the input is missing (even if that field is not read because you have some other logic that prevents the script to execute the else-block).

Does that help?
  Bernd

Hi Bernd,

Yes, that did the trick. So I guess I was missing something.

Thanks for your help,

Natasja