Page 1 of 1

Null handling flat file

Posted: Wed Jun 26, 2013 8:03 am
by mmanes
how do I handle null fields when I read a flat file?
When I read, discard the records.

thank you in advance

Re: Null handling flat file

Posted: Wed Jun 26, 2013 9:09 am
by G.K.K
Use NullFieldValue='' under field properties in formattab of sequential file stage.

Thanks
G.K.K

Posted: Wed Jun 26, 2013 9:14 am
by mmanes
to all types of field?

Posted: Wed Jun 26, 2013 9:24 am
by G.K.K
yes.. provide scenarios if u have any special cases

Posted: Wed Jun 26, 2013 9:53 am
by mmanes
it's not valid for all types (timestamp,decimal, etc...)

Re: Null handling flat file

Posted: Wed Jun 26, 2013 10:49 am
by chulett
mmanes wrote:When I read, discard the records.
You want them discarded or they are being discarded and you want to process them as nulls?

Posted: Thu Jun 27, 2013 3:21 am
by mmanes
are being discarded and I want to process them as nulls.

Posted: Thu Jun 27, 2013 6:26 am
by gaurav_shukla
Use NullFieldvalue property of Sequential stage.

Check format/metadata of your source file, whatever value you get as Null from file for any data type use that value in NullFieldvalue.

For example it could be -

String -NullFieldvalue=''
Decimal - NullFieldvalue=0

Posted: Tue Jul 09, 2013 5:35 am
by srinivas.nettalam
gaurav_shukla wrote:Use NullFieldvalue property of Sequential stage.

Decimal - NullFieldvalue=0
0 (Zero) might actually be a valid value for a number field.There is no "NULL" in a file and it is empty that actually is populated in a file and hence NullFieldValue='' works fine in common.

Posted: Tue Jul 09, 2013 4:07 pm
by ray.wurlod
Text files don't have data types, they only have text. Technically, they can not have NULL. Therefore, all you have to do is to set the NullFieldValue property to the value that represents NULL in each field. And that's a business decision.