You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

Hello,
I have a dbInput -> tJavaRow -> tMap ->dbOutput
In the tJavaRow, I want to check the value of a column and if it's value is 3 or 4, replace that with NULL.
Here is what I am trying, bet getting a NullPointerException:
if (input_row.fromUserId.equals(null)) {
output_row.fromUserId = null;
} else if (input_row.fromUserId.equals(3)) {
output_row.fromUserId = null;
} else if (input_row.fromUserId.equals(4)) {
output_row.fromUserId = null;
} else {
output_row.fromUserId = input_row.fromUserId;
}
This does not seem to be working as expected, does this look correct?
Thanks.
Offline
Hello, mrsocks.
No, this is not correct.
If "input_row.fromUserId" is String, you have to use "" in the param. Like this:
if(input.equals("null")||input.equals("3")||input.equals("4"))
{
input = "null";
}
else
{
input = input;
}
Try it!
Offline

Diego wrote:
Hello, mrsocks.
No, this is not correct.
If "input_row.fromUserId" is String, you have to use "" in the param. Like this:
if(input.equals("null")||input.equals("3")||input.equals("4"))
{
input = "null";
}
else
{
input = input;
}
Try it!
the input is an Integer, so I will leave out the double quotes, correct?
Also,
you have 'input = input;' as the result. Is that correct? I would expect it to be 'output = input;' OR 'output = null;'
Which would actually be correct? If yours, then do I still include:
'output_row.fromUserId = input_row.fromUserId'; after this IF ELSE ?
Thanks.
Offline
No, if the input is an Integer, You will haven't the double quotes. Double quotes You will use when the param is a string.
Check the input default in dbInput is a null value or "" (empty) and post it.
About my code, the result is wrong. The correct is output = input.
Offline
Pages: 1