Jeff Lynch [MVP]

Sponsors

The Lounge

Wicked Cool Jobs

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
BizTalk Server 2004: Flat-file Custom Date/Time Formats

If you've ever used BizTalk Server 2002 to transform legacy flat-file formats to and from XML, you know how difficult it can be to handle date/time conversions. Most legacy systems' dates do not conform to the ISO 8601 formats and the conversion process meant using a Scripting functoid and some custom VB-Script code.

In BizTalk Server 2004 or BizTalk Server 2006, this has all changed. Now, when you are creating a flat file schema and you set the Data Type property of a Field Element or Field Attribute node to xs:dateTime, xs:time, or xs:date, you can use the Custom Date/Time Format property to specify an alternative format for date or time values as shown in Figure 1 below.


Figure 1: Custom Date/Time Formats

This simple improvement can save hours of development time and makes mapping between legacy file formats that much easier to accomplish.

Another "Blinding Flash of the Obvious!"


Posted Sat, Feb 18 2006 8:42 PM by Jeff Lynch
Filed under:

[Advertisement]

Comments

Greg Forsythe wrote re: BizTalk Server 2004 - Flat-file Custom Date/Time Formats
on Thu, Aug 26 2004 2:07 PM
This is a fantastic feature

BUT BEWARE the flat file must contain a date. You can not use this feature on an optional field.

For optional non-ISO 8601 date fields in a flat file you must declare the date as a string and if required handle the transform within a map or orchestration.
Eric Stott wrote re: BizTalk Server 2004 - Flat-file Custom Date/Time Formats
on Sat, Sep 4 2004 2:41 PM
the previous re: does not specify the consequences if it does not have a date!
If you specify a custom date, and the date is NOT on the input, the pipeline returns this error:
Unable to read the stream produced by the pipeline. Details: Value cannot be null.
Parameter name: format

Not very descriptive!
What I ended up doing was defining the destination as a string and then used inline c# coding to populate the fields with the data that MIGHT be on the input:
public string MyConcat(string param1)
{
return param1.Substring(0, 4) + param1.Substring(5,2) + param1.Substring(8,2);
}
Which took a YYYY-MM-DD to YYYYMMDD format, which is not necessarily 'save hours of development time' - but ended up being creating hours of debugging time!
Tareq Muhammad wrote re: BizTalk Server 2004 - Flat-file Custom Date/Time Formats
on Sun, Sep 12 2004 3:30 AM
Very good note, Thank you
John wrote re: BizTalk Server 2004: Flat-file Custom Date/Time Formats
on Fri, Feb 24 2006 2:16 PM
As I recall, BTS2002's editor let you do the exact same custom data definition - you could define a field as a date with a specific format and have it import/convert properly (just as you've shown in 2004) without using functoid conversion.
BA wrote re: BizTalk Server 2004: Flat-file Custom Date/Time Formats
on Mon, Feb 27 2006 6:16 AM

I wish this feature was possible with mappings. We had to create a custom date functoid for this
Devlicio.us