BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reindex routine

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Frank
Guest





PostPosted: Mon Dec 22, 2003 11:14 pm    Post subject: Reindex routine Reply with quote



I have a reindexing routine that I want to make more general, but I can't
think a way to pass the parameter the routine needs.
Here is how I call the reindexing routine :
if ReindexTable(MyTable) then
.................
and this is my function definition:
function ReindexTable(aTable: TTable): boolean;
begin
.....
end;

I want to be able to pick up which table I want to reindex from a list (an
array or something similar, so that I can loop through it). But if I use:
ReindexTable(TablesList[1])
this gives an error, since TablesList[1] is a string, while aTable is a
TTable type. How can I circumvent this problem ? I guess the solution is not
difficult, but I am after a different problem still unsolved and I fell a
bit lost. So perhaps someone can help get me up again...


Back to top
Rob Kennedy
Guest





PostPosted: Tue Dec 23, 2003 12:32 am    Post subject: Re: Reindex routine Reply with quote



Frank wrote:
Quote:
I want to be able to pick up which table I want to reindex from a list (an
array or something similar, so that I can loop through it). But if I use:
ReindexTable(TablesList[1])
this gives an error, since TablesList[1] is a string, while aTable is a
TTable type. How can I circumvent this problem ?

Instead of storing strings, store TTable references. Or, if you
absolutely must store strings, write another funtion that returns a
TTable object that a given string represents.

function StringToTable(const S: string): TTable;

Without knowing more about either the strings or the tables, that's
about the best I can do.

Quote:
I guess the solution is not
difficult, but I am after a different problem still unsolved and I fell a
bit lost. So perhaps someone can help get me up again...

Well, until you tell someone what that different problem is, I suspect
it is going to _remain_ unsolved.

--
Rob

Back to top
Bruce Roberts
Guest





PostPosted: Tue Dec 23, 2003 6:43 am    Post subject: Re: Reindex routine Reply with quote




"Frank" <iuesei (AT) virgilio (DOT) it> wrote

Quote:
I have a reindexing routine that I want to make more general, but I can't
think a way to pass the parameter the routine needs.
Here is how I call the reindexing routine :
if ReindexTable(MyTable) then
.................
and this is my function definition:
function ReindexTable(aTable: TTable): boolean;
begin
.....
end;

I want to be able to pick up which table I want to reindex from a list (an
array or something similar, so that I can loop through it). But if I use:
ReindexTable(TablesList[1])

// reindexes all passed tables, returns -1 if sucessful, otherwise index of
table with problem
// usage: ReindexTables ([table1, table2])
//
function ReindexTables (const theTables : array of tTable) : integer;

begin
result := High (theTables);
while (result >= Low (theTables)) and ReIndexTable (theTables [result]) do
dec (result);
end;

Quote:
this gives an error, since TablesList[1] is a string, while aTable is a
TTable type. How can I circumvent this problem ? I guess the solution is
not
difficult, but I am after a different problem still unsolved and I fell a
bit lost. So perhaps someone can help get me up again...

Otherwise, what Rob said.



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.