| Chat with a LIVE Microsoft
Access Expert! |
||||
|
||||
|
#1
|
|||
|
|||
|
File Parsing and Creating Error Report
1. I have a flat file (.txt) which I need to parse
C01121036200529400100000 0000000278 C10121036200529400100000 5500000001 010 basically file is of size 146 and has 4 different types of records namely C01, C10,C20,C30.Only one C01 and C10 record while multiple C20,C30 records. Each line contains one record. 2. Record structure of each record type is different. 3.Parse the .txt file,identify record type 4.Based on corresponding record structure apply validation rules 5.Generate error report where data violates validation rules. can you please help me out to do this in best possible way. |
| Sponsored Links |
|
#2
|
||||
|
||||
|
I would say VBA. Create tables to hold the data and read the file with VBA and parse and validate on the fly.
BUT it can be done with queries by reading the text rows into a single text column table, then running queries against that to parse the data into separate tables and then run validation queries against those. VBA is a better approach I think how ever.
__________________
E Pluribus Unum - Out of Many, One |
|
#3
|
|||
|
|||
|
Can you provide me sample code/function.
My goal is to build a small Access application , 1. Which will alllow user to select a particular file 2. when user selects the file and click ok ok/parse button , system will parse the file and generate error report. suppose my file has 4 different type of records , identified by record type filed. If I take first record , say c01 record , with sample data as C01121036200529400100000 0000000278 then 121036 shows time 2005294 shows date (yyyyddd) (field type:char) 001 shows version number (field type:char) 000000 shows sequence number (field type:num) 0000000278 shows no of records in file. (field type:num) char type fields should be checked as not null or spaces while number field should be checked whether they contains number fields at all. Once these basic checks are done there are some other business validation as well. please elaborate the details with some sample code. Txs |
|
#4
|
||||
|
||||
|
You could create 4 subs that process each kind of transaction. Then a simple:
Select CASE LEFT(MyRecord,3) Case "C01" Call C01_process(Myrecord) Case "C10" call C10_process(Myrecord) Case "C20" call C20_process(Myrecord) Case "C30" call C30_process(Myrecord) Each routine will parse and validate each transaction type in this way. You just need somewhere to put it.
__________________
E Pluribus Unum - Out of Many, One |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| parsing an imported field | crgowo | General | 4 | 05-13-2003 06:26 AM |