View Full Version : Help with creating tables for log file


xah
10-05-2010, 01:03 AM
Can someone help by giving me examples code of pointing the right way for the following.

For monitoring and reporting purposes I want to use Access as database for a log file.

First I'll import the log file in let's say Table-A then transform it to Table-B like I want it to be. Example of what I mean:

Table-A:
id|log
==|=============================================== ===============
01|-------- XCOM TRANSFER STARTED ------------
02|di 24-11-2009
03|16:00
04|TRANSFER FILE :DCPP_1124155523_IPEILIAS_RTR_AH_0.spl
05| 1 file(s) moved.
06| 1 file(s) moved.
07|TRANSFER OF DCPP_1124155523_IPEILIAS_RTR_AH_0.spl FINISHED
08|-------- XCOM TRANSFER ENDED ------------

Table-B:
id|datum |tijd |spool file |transfer started|transfer finished
==|=============|=====|=========================== ==========|================|==================
01|di 24-11-2009|16:00|DCPP_1124155523_IPEILIAS_RTR_AH_0.spl|T RANSFER STARTED|TRANSFER FINISHED
The string manipulation I can do. I need help with, tranforming the multiple rows per transfer information (Table-A) to one row per transfer (Table-B).

I would prefer not using Visual Basic scripts if there's another way just by using SQL queries and Access functions.

Any help/suggestions are welcome...

gemma-the-husky
10-05-2010, 01:15 AM
you could do this

import the text file
delete any row that doesnt start with "transfer" (or any other filter you like)
use split function to analyse the text
use append/update statments to insert the data into your dbs proper

-------------
sorry - just read this again, and you need many of the rows

so instead

open the file as an external file
open filename for input as #1
use
line input #1 to read lines
(but research freefile rather than use #1)

now
use split function to analyse the text
use append/update statments to insert the data into your dbs proper

interesting, and relatively straightforward to do

xah
10-05-2010, 01:23 AM
you could do this

import the text file
delete any row that doesnt start with "transfer" (or any other filter you like)
use split function to analyse the text
use append/update statments to insert the data into your dbs proper

-------------
sorry - just read this again, and you need many of the rows

so instead

open the file as an external file
open filename for input as #1
use
line input #1 to read lines
(but research freefile rather than use #1)

now
use split function to analyse the text
use append/update statments to insert the data into your dbs proper

interesting, and relatively straightforward to do

But how do I get the date and time per row?

And what do you mean with:
the file as an external file
open filename for input as #1
use
line input #1 to read lines
(but research freefile rather than use #1)

gemma-the-husky
10-05-2010, 01:51 AM
1. read in a row.

If it starts with di, its a date etc. you must have some way of determining exactly what the row is.

or if every file is guaranteed to be of the same format, then just count rows. so row 4 includes the date. or test the first two chars. so "02" is the date.

it just depends on exactly what format the text file wil ltake.


2. the syntax is
open filename for input as #channelnumber

so you can hardcode this as #1, but if you already HAVE an open channel 1, this will fail

freefile finds the first unused channel

so

channum = freefile
open filename for input as #channum


3. finally dont forget to close the file when you are done

close #channum