<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>1500 records in memory is nothing. I recently
tested a TStringList with up to 100,000 filenames with full paths. It only
required about 5 megs of memory and loaded fairly quickly. The
Sorted property of the StringList was then set to True which sorted the list,
again not taking long at all. And finally used the Find method to
find strings in the list. This was blindingly fast. I
definately suggest using this method.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Regards,</FONT></DIV>
<DIV><FONT face=Arial size=2>Ross.</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=vss@vss.co.nz href="mailto:vss@vss.co.nz">Jeremy Coulter</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=delphi@delphi.org.nz
href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, October 08, 2004 8:30
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [DUG] there has to be a better
way to do this....</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>HI
All.</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>We have a database
that stores phone numbers but Country Code and location
code.</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>i.e. 0061 -
australia, 786 - gold coast</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>We pass a number
to a function, and this function finds where the number is
for.</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>The location code
has a max length of 9 numbers, and so what I do is currently loop FOR
x:=9 downto 1, and it querys the DB i.e. select * from the_table where
location = copy(number,1,x)</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>BUT I REALLY thik
this is bad...whilst it works, its not prob. the best thing to do....i.e.
potentually 9 querys to a db.</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>There HAS to be a
better way to do this !</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>I did think maybe
of storing the data into a collection and itterating thru the collection which
would be a HELL of a lot faster than going to the DB, but how obscene would it
be to store over 1500 records into memory?</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>I thought there
might be away to do it even in an SQL statement, but I cant think of how to
structure it....this is an Access DB too, although after xmas it will be MS
SQL Server (and MSDE).</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial size=2>If anyone has some
thoughts, let me know.....this should get the list going again
:-D</FONT></SPAN></DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=109472219-07102004><FONT face=Arial
size=2>Jeremy</FONT></SPAN></DIV></BLOCKQUOTE></BODY></HTML>