Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Import from CSV: Empty Value

Hello!

I created a CSV file from Script where I get something like:

Account,Zone,Date

01,A,05/07/2014

02,A,08/10/2014

03,,03/07/2014

As you can see, I have some empty values without Zones, like Account 03.

Then I load this file as a table and I get an Empty/Blank value for some Zones.

Is there any way to convert those blank into null or something else? How can I do?

Thank you!!!

3 Replies
maxgro
MVP
MVP

maybe (replace inline load with your real file)

file:

load * inline [

Account,Zone,Date

01,A,05/07/2014

02,A,08/10/2014

03,,03/07/2014

]

;

table:

noconcatenate

load

Account,

if(len(trim(Zone))=0, 'zone is empty', Zone) as Zone,

Date

resident file;

drop table file;

its_anandrjs

Update now check please

You can add null values in the blank values see the example load

tmp:

LOAD * Inline

[

Account,Zone,Date

01,A,05/07/2014

02,A,08/10/2014

03,,03/07/2014

];

NoConcatenate

Final:

LOAD

Account,if(Len(Zone) = 0,  Null(),Zone) as Zone,Date

Resident tmp;

DROP Table tmp;

godfreydaniels
Contributor III
Contributor III

Try near the top of the script:

Set NullInterpret = '';