BizTalk–Seemingly Random Carriage Returns in Flat File Output
A few days ago I was troubleshooting an odd error in one of our pipe delimited flat file outputs from a map. The application was just migrated from BizTalk 2004 to BizTalk 2010, and had developed a unique problem. This file was showing what seemed like random carriage returns in the output flat file.
After ruling out any errors with the generic flat file assembly pipeline or map, I pinpointed the issue being spaces contained within the input to one of the maps. The input comes from a WCF SQL request-response port, and was contained within the data itself, not artificially inserted by the adapter. Since I was using default padding (space) for the flat file, a single space in the input XML was causing the flat file send pipeline to interpret the spaces as the start of a new record entry. Below is an example of how the space as showing up within the input file.
In order to remedy this, I changed the map which was mapping from the WCF-SQL response to the flat file schema by adding an String Left Trim Functoid between the source and destination as so.
This allowed the space to be removed, and the data point interpreted as a null value in the output flat file in-between two pipe delimiters.