Jump to content

Recommended Posts

i have multiple text files (not a lot of records < 3-4K) that i need to search thru finding matches based upon user input.

example:

Date, Time, Descript_1, Value_1, Descript_2, Value_2, Descript_3, Value 3, Descript_4, Value_4

01/01/24,08:00:00,Springs, 25, Nuts, 14, Bolts, 75, washers, 207

01/01/24,08:00:15,Springs, 25,Bolts, 35,Nuts,1,washers,12

and so on.

now in the past i have loaded up the files to SQL tables and then search for the matches. works ok but now user wants to enter all of the search parameters into a file and do all the searching at once. again not a big deal since i can again read and search. Not that it takes a long time but his system isn't that up to speed and IS rather slow at searching. SO now i want to change the process. I want to create a record array of the date, time, description and values. then just read his search input file (without creating a new record array) and just do a search  directly on the record arrays.

I have searched and found the TList but they only show a single column matching whereas i need to match the descript_# and value_# for each pairing. like the descript_1 = Springs and value_1=25, then compare the next group because they all have to match in the same sequence. 1's have to match, 2's have to match, 3's have to match and the 4's

i am trying to understand TList but so far am falling short

type
  TMyRec = packed record
    dt : Tdate;
    tm " Ttime;
    d1 : string;
    v1 : integer;
    d2 : string;
    v2 : integer;
    d3 : string;
    v3 : integer;
    d4 : string;
    v4 : integer;
  end;

 

Share this post


Link to post

Using SQL to query <100k records in a memory table shouldn't be slow on even a 300Mhz Pentium 2 with spinning rust with even a small number of indexes to help. 

I wonder what you are doing to make it so slow. 

 

Something like SQLite is well optimized and shouldn't be slow at this, especially if you load the data into in-memory tables and add an index or two.  

 

Share this post


Link to post

Don't re-invent the wheel. Use a TClientDataSet or some other in-memory table with indices set up on the columns and it should run like greased lightning. (That's what adding an index to a column is for!)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×