One Star

Column 'ColumnName' cannot be null error: though schema set to accept

Hello,
I can't seem to get rid of NULLs appearing in my job (and stopping the mapping due to the above error)
At first I had "Nullable" unchecked, so I can understand the error...
Then I checked Nullable and also gave my fields default values as well (then removed the default values)
Still when I run the job I get the Column 'ColumnName' cannot be null
Ideally I'd like to actually make them not null, but place a default value in them as part of the ETL
Thank You Smiley Happy
10 REPLIES
Moderator

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi,
Could you please elaborate your case with an example with input and expected output values? flow?
Usually, you can transform the data on tMap component, If there are some values And null values(Empty) in your input source.
Write the expression on the output table of tMap like:
row1.columnName==null||row1.columnName.equals("")?"default":row1.columnName
Check the nullable box of the column on the schema if you want to compare the object is null or not.
The expression should be: row1.columnName==null?null:row1.columnName
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Thanks ok
Five Stars

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi,
How is the column defined in your database schema? Does it allow null values? Not sure if you checked this already but wanted to mention it - I just had a similar scenario.
Tom
Moderator

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi, ddctf
Is your job working? Feel free post your issue on forum.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi, thanks I seem to have gotten past this error, can mark as resolved
Moderator

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi,
Thanks for your feedback.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi!
I have a simlar problem with Null values. In my case I need to concatenate two fileds, Christan Name and Last Name. The null values do not disapper in my output file. The filed Efternamn (last name) sometime is empty and cases the null values.
row1.FOERNAMN+" "+(row1.EFTERNAMN ==null?null:row1.EFTERNAMN)
What might be wrong in my formula.
BR
Krister
Four Stars

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Hi Krister,
Your input is empty and not null. So, check for the length of input for that column and set empty if true else set actual.
row1.FOERNAMN+" "+(StringHandling.LEN(row1.EFTERNAMN) < 1?"":row1.EFTERNAMN)
Thanks
Vaibhav
One Star

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Thanks this was likely my error too
One Star

Re: Column 'ColumnName' cannot be null error: though schema set to accept

Probably best to check for both the absence of null and the existence of a value..
row1.FOERNAMN + " " + ((row1.EFTERNAMN != null && row1.EFTERNAMN.length() > 0) ? row1.EFTERNAMN : "")