Is there a method where by one can read just the first record of a file; i.e to read header information, so that a decision can be made whther or not to process the remainder of the file ? I know that with the split transformation component one can write an expression that will ignore all of the rows besides the header, based on a key word in the header, but would rather not go that route, as that is inefficiently reading every record in the file. Specifically, is there script component logic that I can implement to close the file, and end the dataflow after the first record has been read ?
views:
659answers:
1
+1
A:
See this post from Todd McDermid:
Basically, you would set up a Foreach Container to loop over the files in your directory. Inside the Foreach, you would determine the "file type" - perhaps by creating a variable with a long-winded expression on it that pulls apart your file name and assumes the a "file type" value - then passes control on to one of five Data Flows via conditional connectors. (Double-click on the standard green connector, change it's Evaluation Operation to Expression and Constraint, and set the expression to be "file_type_variable = ".) Then each Data Flow picks apart one "file type".
Mitch Wheat
2009-02-22 02:47:54