Thread View: comp.lang.pascal.delphi.misc
3 messages
3 total messages
Started by Christian Hartmann
Wed, 15 Sep 2004 17:41
Sorting of 4 String-Lists
Author: Christian Hartmann
Date: Wed, 15 Sep 2004 17:41
Date: Wed, 15 Sep 2004 17:41
20 lines
1453 bytes
1453 bytes
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
Re: Sorting of 4 String-Lists
Author: Tom de Neef
Date: Thu, 16 Sep 2004 08:33
Date: Thu, 16 Sep 2004 08:33
43 lines
2846 bytes
2846 bytes
"Christian Hartmann" <cha@christian-hartmann.de> schreef in bericht news:7c275508.0409150941.6f82c64e@posting.google.com... > 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
Re: Sorting of 4 String-Lists
Author: Christian Hartmann
Date: Thu, 16 Sep 2004 17:11
Date: Thu, 16 Sep 2004 17:11
9 lines
1067 bytes
1067 bytes
Dear all, thank you for the help. I think I will give the record-way a try. Regards, Christian
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads