 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Christian Hartmann Guest
|
Posted: Wed Sep 15, 2004 5:41 pm Post subject: Sorting of 4 String-Lists |
|
|
Dear all,
I have got 4 StringLists that are connected via the Index (all data in
the 4 string-lists with the same index are one whole business
information). Now I want to sort 3 of them based on the sorting of
one. Does anyboday have got a pattern how to do this?
Example:
The second string-list is taken to be sorted alphabetically. Now the
1st, 3rd, and 4th String-List should be sorted liek the second one
based on the index.
So, does anyboday have got a pattern how to do this?
Any help will be appreciated. Thank you in advance.
Regards,
Christian Hartmann
|
|
| Back to top |
|
 |
Tom de Neef Guest
|
Posted: Thu Sep 16, 2004 8:33 am Post subject: Re: Sorting of 4 String-Lists |
|
|
"Christian Hartmann" <cha (AT) christian-hartmann (DOT) de> schreef in bericht
news:7c275508.0409150941.6f82c64e (AT) posting (DOT) google.com...
| Quote: | Dear all,
I have got 4 StringLists that are connected via the Index (all data in
the 4 string-lists with the same index are one whole business
information). Now I want to sort 3 of them based on the sorting of
one. Does anyboday have got a pattern how to do this?
Example:
The second string-list is taken to be sorted alphabetically. Now the
1st, 3rd, and 4th String-List should be sorted liek the second one
based on the index.
So, does anyboday have got a pattern how to do this?
Any help will be appreciated. Thank you in advance.
Regards,
Christian Hartmann
|
What you do seems very dangerous and error-prone. Any change in one of the
stringlists must be reflected in the three others (insert, delete, change
order). Sooner or later you will resent the approach.
I can see three alternatives:
a) disband the four stringlists and introduce a new recordbased Tlist
instead, containing the four strings.
b) construct one new record out of the four strings upon loading. And put
these records in their own Tlist. Upon saving you can split them out again
into four stringlists. No problems with insertion, deletion and
interchanging.
c) link the strings in the Tstringlists via a common object. Each
Tstringlist has an Objects property and each string in the list can be
associated with an object. So: create a link record (object) with pointers
to the four strings that belong together and associate the four strings with
this object. Sorting of one list will not affect the association of the
strings with their objects and thus with their couterparts in the other
lists. But deletion and insertion are to be considered as well. All in all:
much more complex than a) or b).
Tom
|
|
| Back to top |
|
 |
Christian Hartmann Guest
|
Posted: Thu Sep 16, 2004 5:11 pm Post subject: Re: Sorting of 4 String-Lists |
|
|
Dear all,
thank you for the help.
I think I will give the record-way a try.
Regards,
Christian
|
|
| 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
|
|