BrianMH
03-28-2011, 04:37 AM
Hi,
I currently work for a company that recieves files in multiple formats. Our team converts these files so that it can be read in our main database and the appropriate action taken the accounts. Conversion of these files is easy however effectively capturing them can sometimes prove difficult.
Each file comes in as a csv file. It comes in with a header with file details and a footer advising how many 'flows' are included in the file.
Each action that needs to be taken in our system is contained in the flow type and the information required is included.
An example of this is:
"T01",1177,"SR","P",20110325,201304,1949
"T09",7793168,"7065406546","1322092","EH32","9GL",20110420,20110325,201304
"T09",7793201,"7065406912","999454","LE67","3BB",20110419,20110325,201304
"T09",7793204,"7456718602","521167","LN4","2UQ",20110419,20110325,201304
"T17",7716326,"","7481238806","718409","LE11","5DY",20110406,"GUK"
"T17",7716363,"","7489999306","448977","NG16","",20110406,"GUK"
"T17",7719301,"","7487155304","434805","MK19","7EG",20110415,"BGT"
"T17",7719302,"","7486688211","460905","NG24","4JT",20110415,"BGT"
"T16",7727512,"15695509","31547","DUMM","7485299102",1339046,"ATC0008637","E9701","1BB","1","5","S80","2LQ","736404",2000,5,"CRED","M","32","U6","UGI","N",20110406,"",20110325,201304,"N","SOP","6734"
"T16",7727513,"15696777","31490","MORR","7486281604",1339416,"ATC0032402","E9701","4BS","1","21","DE11","0QB","3499",2003,5,"CRED","M","32","G4","ACT","N",20110406,"",20110325,201304,"N","BGT","20245"
"T99",11
Currently to work with this data our team is running a macro to import these files into a spreadsheet then we copy each line and put it into an access database table for each different flow or action type.
Sometimes an action has further information in new lines with a related code.
For instance
T44, data, data, data
T01, reason for t44
T01, further reason for t44
T01, futher reason for t44
This is industry data so I cannot get the way it comes in redesigned but I would like to programmatically handle this data. I have tried to import this data directly into access in the past but since the columns on the file can hold different data types due to the lengths of each individual flow it often has errors importing it or completely misses some of it out. Another issue is that any automatic sorting of a table messes with the structure and relationship. So for example the T44 above needs the T01 directly after it as there is nothing to discern its relationship other than its position in the file.
I am looking for some suggestions as to how I can read these text files directly and how I can break them down to fields.
Thanks for any advice, links, etc in advance.
I currently work for a company that recieves files in multiple formats. Our team converts these files so that it can be read in our main database and the appropriate action taken the accounts. Conversion of these files is easy however effectively capturing them can sometimes prove difficult.
Each file comes in as a csv file. It comes in with a header with file details and a footer advising how many 'flows' are included in the file.
Each action that needs to be taken in our system is contained in the flow type and the information required is included.
An example of this is:
"T01",1177,"SR","P",20110325,201304,1949
"T09",7793168,"7065406546","1322092","EH32","9GL",20110420,20110325,201304
"T09",7793201,"7065406912","999454","LE67","3BB",20110419,20110325,201304
"T09",7793204,"7456718602","521167","LN4","2UQ",20110419,20110325,201304
"T17",7716326,"","7481238806","718409","LE11","5DY",20110406,"GUK"
"T17",7716363,"","7489999306","448977","NG16","",20110406,"GUK"
"T17",7719301,"","7487155304","434805","MK19","7EG",20110415,"BGT"
"T17",7719302,"","7486688211","460905","NG24","4JT",20110415,"BGT"
"T16",7727512,"15695509","31547","DUMM","7485299102",1339046,"ATC0008637","E9701","1BB","1","5","S80","2LQ","736404",2000,5,"CRED","M","32","U6","UGI","N",20110406,"",20110325,201304,"N","SOP","6734"
"T16",7727513,"15696777","31490","MORR","7486281604",1339416,"ATC0032402","E9701","4BS","1","21","DE11","0QB","3499",2003,5,"CRED","M","32","G4","ACT","N",20110406,"",20110325,201304,"N","BGT","20245"
"T99",11
Currently to work with this data our team is running a macro to import these files into a spreadsheet then we copy each line and put it into an access database table for each different flow or action type.
Sometimes an action has further information in new lines with a related code.
For instance
T44, data, data, data
T01, reason for t44
T01, further reason for t44
T01, futher reason for t44
This is industry data so I cannot get the way it comes in redesigned but I would like to programmatically handle this data. I have tried to import this data directly into access in the past but since the columns on the file can hold different data types due to the lengths of each individual flow it often has errors importing it or completely misses some of it out. Another issue is that any automatic sorting of a table messes with the structure and relationship. So for example the T44 above needs the T01 directly after it as there is nothing to discern its relationship other than its position in the file.
I am looking for some suggestions as to how I can read these text files directly and how I can break them down to fields.
Thanks for any advice, links, etc in advance.