Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load or Display Null Values as "Unknown"

I have production status values in a Status field and some rows contain null values. How do I either load or display the null values as "Unknown" ?

1 Solution

Accepted Solutions
JonnyPoole
Employee
Employee

the isnull() function will check if a value is null.

So in the load editor you could recalculate each status using an IF() expression using isnull() as the condition as follows:

LOAD

     if ( isnull(Status),'Unknown', Status)  as Status,

     otherfields...

from <source>

View solution in original post

3 Replies
JonnyPoole
Employee
Employee

the isnull() function will check if a value is null.

So in the load editor you could recalculate each status using an IF() expression using isnull() as the condition as follows:

LOAD

     if ( isnull(Status),'Unknown', Status)  as Status,

     otherfields...

from <source>

jagan
Luminary Alumni
Luminary Alumni

Hi Jason,

I think handling this in script is a better option, try any one this in script

TableName:

LOAD

*,

Alt(Status, 'Unknown') AS Status

FROM DataSource;


OR


TableName:

LOAD

*,

If(Len(Trim(Status)) > 0, Status,  'Unknown') AS Status

FROM DataSource;


OR


TableName:

LOAD

*,

If(IsNull(Status),  'Unknown', Status) AS Status

FROM DataSource;


Regards,

Jagan.

Not applicable
Author

Awesome, thank you Jonathan!