 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Frank Guest
|
Posted: Mon Dec 22, 2003 11:14 pm Post subject: Reindex routine |
|
|
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
|
Posted: Tue Dec 23, 2003 12:32 am Post subject: Re: Reindex routine |
|
|
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
|
Posted: Tue Dec 23, 2003 6:43 am Post subject: Re: Reindex routine |
|
|
"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 |
|
 |
|
|
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
|
|