Can one file contain 10,000 files of different size?
Author |
Message |
Guy Douce #1 / 7
|
 Can one file contain 10,000 files of different size?
I have a customer database with approx 10,000 records (10,000 customers). Each record is the same length (of course!). But I would like to keep track of various events for each customer. Most customers will have 1 or 2 events (transaction), but others may have 100 events, some may even have 1000 events. What I have done is created a text file for each customer and placed the information there. For instance, the events of customer #1 are stored in file EV00001.DAT. It works ok, but you must realise that I can have up to 10,000 event files and more. Is there a better way of doing this, like having one file instead of 10,000 ? All information appreciated, G.Doucet
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
 |
Curtis Spendlo #2 / 7
|
 Can one file contain 10,000 files of different size?
Quote: >Is >there a better way of doing this, like having one file instead of 10,000 >?
Forgive me if I misunderstand, but it sounds like you're currently already using a database to hold the customers... It would depend on exact what an "event" is. If it's merely a transaction, I would suggest creating a table which stores the information and just dropping it back into the database with the customers. It will be much more simple and more powerful. ----- tblCustomerEvents ce_id - unique id ce_event - event type (probably foreign key) cm_id - customer id (foreign key to customer master) ----- This would allow more sophisticated use of this data... "SELECT * FROM tblCustomerEvents WHERE cm_id=" & cust.id & "ORDER BY ce_event" Using the database, you wouldn't need to parse a slew of text files for the information... -Curtis Spendlove -Solstice Software
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
 |
Kotar #3 / 7
|
 Can one file contain 10,000 files of different size?
Quote: > I have a customer database with approx 10,000 records (10,000 > customers). Each record is the same length (of course!). But I would > like to keep track of various events for each customer. Most customers > will have 1 or 2 events (transaction), but others may have 100 events, > some may even have 1000 events. What I have done is created a text file > for each customer and placed the information there. For instance, the > events of customer #1 are stored in file EV00001.DAT. It works ok, but > you must realise that I can have up to 10,000 event files and more. Is > there a better way of doing this, like having one file instead of 10,000 > ? > All information appreciated, > G.Doucet
The best way by far would be to put this data into a Jet Database (.mdb) file. If you don't want to do that, you Could put the transactions in a Random file (assuming they're all the same length), then keep a sorted random index file, use Binary search techniques to find the transaction records for a customer, etc. That's a heck of a lot of work to avoid using the database, though. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
 |
Steve Szudzi #4 / 7
|
 Can one file contain 10,000 files of different size?
Guy, Can you add another table into your database? If so, you could create an events table that has an index field that would coorelate to the customer ID number. Then you could add other fields for the miscellaneous event data. This way you could quickly do a search through all of the records in the event database where the field matches the customer id you have... Steve Szudzik "My opinions are my own and do not necessarily reflect those of my employer."
Quote: > I have a customer database with approx 10,000 records (10,000 > customers). Each record is the same length (of course!). But I would > like to keep track of various events for each customer. Most customers > will have 1 or 2 events (transaction), but others may have 100 events, > some may even have 1000 events. What I have done is created a text file > for each customer and placed the information there. For instance, the > events of customer #1 are stored in file EV00001.DAT. It works ok, but > you must realise that I can have up to 10,000 event files and more. Is > there a better way of doing this, like having one file instead of 10,000 > ? > All information appreciated, > G.Doucet
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
 |
James Pars #5 / 7
|
 Can one file contain 10,000 files of different size?
If you are using a database, you would probably just want to add a table of transactions with a field that allows you to associate the transactions with a specific customer. If you are doing it all in code, I would recommend a random access file where each record is a transaction. The customer database could have a field that points to the first transaction record in the random access file, and each transaction record could have a field that points to the next transaction. The last transaction would have a null pointer, and if there were no transactions at all the field in the customer database would be a null pointer. In other words, make a linked list of transactions. You could have a linked list of deleted records that will be reused as additional records get added, etc. This sort of programming is a lot of fun. The one thing you definitely don't want to do is have 10,000 files. Even if a file only contains 1 or two events, it will still take up a cluster of disk space which could be 32767 bytes.
Quote: >I have a customer database with approx 10,000 records (10,000 >customers). Each record is the same length (of course!). But I would >like to keep track of various events for each customer. Most customers >will have 1 or 2 events (transaction), but others may have 100 events, >some may even have 1000 events. What I have done is created a text file >for each customer and placed the information there. For instance, the >events of customer #1 are stored in file EV00001.DAT. It works ok, but >you must realise that I can have up to 10,000 event files and more. Is >there a better way of doing this, like having one file instead of 10,000 >? >All information appreciated, >G.Doucet
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
 |
Bob Kolesa #6 / 7
|
 Can one file contain 10,000 files of different size?
Why not add a memo field called "Transactions"?. Quote:
>I have a customer database with approx 10,000 records (10,000 >customers). Each record is the same length (of course!). But I would >like to keep track of various events for each customer. Most customers >will have 1 or 2 events (transaction), but others may have 100 events, >some may even have 1000 events. What I have done is created a text file >for each customer and placed the information there. For instance, the >events of customer #1 are stored in file EV00001.DAT. It works ok, but >you must realise that I can have up to 10,000 event files and more. Is >there a better way of doing this, like having one file instead of 10,000 >? >All information appreciated, >G.Doucet
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
 |
Charles E. Bortle, Jr #7 / 7
|
 Can one file contain 10,000 files of different size?
Hello Guy, I would second Bob's suggestion, but I would also suggest another idea too. Add Bob's Transaction memo field to hold the details, but also add another field, called, say, Transaction Number. Now, for each customer, enter a new record for each transaction, using a new transaction number. If the customer name and transaction number are part of the primary key, the records will sort out, and, presuming the correct order of the fields in the key, each customer's transactions will be grouped together by the sorting. You could even save some space by having a seperate table for the Transaction memo field with a unique key tying each Transaction memo to a particular customer transaction entry in the main table, that way only those records that need the Transaction memo would create a memo field. Just my 2cents worth, Hope you find it helpful, --
"For God So Loved The World, That He Gave His Only Begotten Son, That Whosoever Believeth In Him Should Not Perish, But Have Everlasting Life"John3:16 * http://pw2.netcom.com/~cbrtjr/wrdthing.html * Quote:
>Why not add a memo field called "Transactions"?.
>>I have a customer database with approx 10,000 records (10,000 >>customers). Each record is the same length (of course!). But I would >>like to keep track of various events for each customer. Most customers >>will have 1 or 2 events (transaction), but others may have 100 events, >>some may even have 1000 events. What I have done is created a text file >>for each customer and placed the information there. For instance, the >>events of customer #1 are stored in file EV00001.DAT. It works ok, but >>you must realise that I can have up to 10,000 event files and more. Is >>there a better way of doing this, like having one file instead of 10,000 >>? >>All information appreciated, >>G.Doucet
|
Sun, 02 Dec 2001 03:00:00 GMT |
|
|
|