Posts Tagged ‘how to ignore empty fields in delimited flatfiles’

FlatFile xs:Date field with an empty value

June 8, 2011 Leave a comment

I have seen this issue a couple of times and thought of recording this.


After generating a flat file schema with optional elements(minoccurs =0) of type date,int,decimal etc., which does not accept a ‘ ‘  value, we might endup with an error as follows.

error BEC2004: The ‘JoinDate’ element is invalid – The value ” is invalid according to its datatype ‘’ – The string ” is not a valid XsdDateTime value.


This exception is perfectly valid from the compiler’s perspective. Here comes the example.

Suppose my flatfile schema is generated using the following imput and is demilited by ‘|’ .


As the date field(highnlighted in red) is optional in our scenario, the following input is also valid.


But when BizTalk validates this instance against the schema, it just picks the value between the two ‘|’ symbols for the date field which is ”. Thus it throws the error when it checks if the value ” is valid for a date field. This will occur for any datatype which does not accept ” value.


The Solution is to logically let BizTalk  know priorly that the datefield is optional and it has to ignore if any blank values occur.

This can be done by setting the “Suppress Empy Nodes” Property to “No” at the Schema Level(By Clicking on the word “Schema” above the root node of the flatfile).


This will ensure that BizTalk knows that the field might have empty value and it should ignore it. This will get your validation successful.

Please post your suggestions or comments.