Sunday, February 19, 2012

Footer rows to skip

OK. We know there is Header rows to skip options and it works great.

I've got the file that has a "footer". Here is an example:

.
PSC
filename=table1
records=0000000000525
ldbname=db1
timestamp=2006/02/07-16:25:00
numformat=44,46
dateformat=mdy-1910
map=NO-MAP
cpstream=ISO8859-1
.
0000260611

It's ALWAYS last 12 rows.

Is there a way to split at this point and put the 12 rows in a different location? The task is twofold - I don't need these control rows in my data and I need value of "records" to verify loaded number of rows.

UPDATED: After some testing I found out that the Flat File source does not see that footer at all. This is good and bad - I do want to load this metedat into some other tables.

Dima.

I too have the same type of flat files.

If u have solved this issue. Do help me please.

|||You can use another Data Flow to read the file a second time, with each row as a single column. Use a conditional split to identify the header/footer rows that you're interested in and derived columns (or script if necessary) to do any parsing before sending them to a destination. The downside here is that you have to read the file twice.

Alternatively, you can tackle the whole job in a single Data Flow with a script component that accepts the file rows as a single column, parses them in code, outputs the detail rows in discrete columns, and does whatever necessary for the header and footer. This is slightly more complicated from a code standpoint and the parsing logic could be a lot more tedious than letting the Flat File Source component do it.
|||Or perhaps read the file one time to get the number of rows in a variable and add a rownumber column to each row. Then in a second data flow use a conditional split to redirect the footer rows. This should work if you have a fixed number of rows in the footer.|||Has anyone figured out how to look at the footer rows? The footer row contains the number of rows in the file, and I'd like to use this as a sanity check. Thanks in advance.

|||

killerless wrote:

Has anyone figured out how to look at the footer rows? The footer row contains the number of rows in the file, and I'd like to use this as a sanity check. Thanks in advance.

Yeah. Read the other posts. And you can use a script component in the data flow to assign a value from the footer to a variable to that you can use it in your sanity check.

|||Sorry, Thank you.

No comments:

Post a Comment