I'm looking for advice on strategy and methods, hence selection of data type for a new project.
I'm starting an app that has to deal with two similar lists.
List 1 is small (of the order 100-1000 lines).
List 2 is large in the order of 10,000 lines and up.
All list data is strings (alphanumerics).
List 1 is generated by data entry into the app, and list 1 needs to be saved after each new line is entered, for data loss prevention.
Also, list 1 needs to be loaded from disk in such cases, to pick up where last were.
List 2 is a database essentially and only needs to be loaded at startup and referred to.
Typical list 1 lines could look like so:
13/03/08 A1AAA 10 234 10 021 cabbage
14/03/08 A1BB 11 234 10 329 sprouts
14/03/08 Z1ZAA 10 534 10 321 milk
15/03/08 A2ZAA 11 234 10 123 bread
18/03/08 C9AAA 23 994 10 371 pork
Typical list 2 lines could look like so:
A1AAA cabbage
A1BB sprouts
A2ZAA bread
C9AAA pork
Z1ZAA milk
The 'key' field is the A1AAA style of data.
Note list 2 is sorted by 'key' field, list 1 is sorted by entry date.
The user enters in the data to list 1 manually, except for the date which is inserted from the PC clock.
Loaded and entered data is displayed all the time, in a scrollable list.
As the user enters the 'key' field I want two similtaneous things to occur:
a. In a 'box' will appear matches that the entered data might be, filtering more accurately as more data is entered:
Entry Edit 'box'
A 13/03/08 A1AAA 10 234 10 021 cabbage
14/03/08 A1BB 11 234 10 329 sprouts
15/03/08 A2ZAA 11 234 10 123 bread
A1 13/03/08 A1AAA 10 234 10 021 cabbage
14/03/08 A1BB 11 234 10 329 sprouts
A1A 13/03/08 A1AAA 10 234 10 021 cabbage
A1AC no match
A1ACV no match
b. In another 'box' for each key press in 1 the box would show:
A1AAA cabbage
A1BB sprouts
A2ZAA bread
A1AAA cabbage
A1BB sprouts
A1AAA cabbage
no match
Currently I am loading the data from files, using loadfromfile to a stringlist, then populating a stringgrid and displaying the entered data there.
The striggrid is used to keep the fixed column headings as the list scrolls up.
New entered data complete lines are added to the stringgrid and stringlist, then the stringlist used to do a savetofile.
List 2 I plan to load into a stringlist.
The two 'boxes' in a. and b. I plan to use listboxes.
My questions are:
1. Am I using the correct string containers (the stringlists, stringgrid, and listboxes) or should I use/do something more suitable? (What?)
2. What is the best search routines and method for b. ? (I can see only a sequential 'for beginning to end' working for a.)
3. Is the shell short the most suitable algorithm for sorting list 2 data?
(apologies for long post!)
Steve (Delphi 2007 & XP)
I'm starting an app that has to deal with two similar lists.
List 1 is small (of the order 100-1000 lines).
List 2 is large in the order of 10,000 lines and up.
All list data is strings (alphanumerics).
List 1 is generated by data entry into the app, and list 1 needs to be saved after each new line is entered, for data loss prevention.
Also, list 1 needs to be loaded from disk in such cases, to pick up where last were.
List 2 is a database essentially and only needs to be loaded at startup and referred to.
Typical list 1 lines could look like so:
13/03/08 A1AAA 10 234 10 021 cabbage
14/03/08 A1BB 11 234 10 329 sprouts
14/03/08 Z1ZAA 10 534 10 321 milk
15/03/08 A2ZAA 11 234 10 123 bread
18/03/08 C9AAA 23 994 10 371 pork
Typical list 2 lines could look like so:
A1AAA cabbage
A1BB sprouts
A2ZAA bread
C9AAA pork
Z1ZAA milk
The 'key' field is the A1AAA style of data.
Note list 2 is sorted by 'key' field, list 1 is sorted by entry date.
The user enters in the data to list 1 manually, except for the date which is inserted from the PC clock.
Loaded and entered data is displayed all the time, in a scrollable list.
As the user enters the 'key' field I want two similtaneous things to occur:
a. In a 'box' will appear matches that the entered data might be, filtering more accurately as more data is entered:
Entry Edit 'box'
A 13/03/08 A1AAA 10 234 10 021 cabbage
14/03/08 A1BB 11 234 10 329 sprouts
15/03/08 A2ZAA 11 234 10 123 bread
A1 13/03/08 A1AAA 10 234 10 021 cabbage
14/03/08 A1BB 11 234 10 329 sprouts
A1A 13/03/08 A1AAA 10 234 10 021 cabbage
A1AC no match
A1ACV no match
b. In another 'box' for each key press in 1 the box would show:
A1AAA cabbage
A1BB sprouts
A2ZAA bread
A1AAA cabbage
A1BB sprouts
A1AAA cabbage
no match
Currently I am loading the data from files, using loadfromfile to a stringlist, then populating a stringgrid and displaying the entered data there.
The striggrid is used to keep the fixed column headings as the list scrolls up.
New entered data complete lines are added to the stringgrid and stringlist, then the stringlist used to do a savetofile.
List 2 I plan to load into a stringlist.
The two 'boxes' in a. and b. I plan to use listboxes.
My questions are:
1. Am I using the correct string containers (the stringlists, stringgrid, and listboxes) or should I use/do something more suitable? (What?)
2. What is the best search routines and method for b. ? (I can see only a sequential 'for beginning to end' working for a.)
3. Is the shell short the most suitable algorithm for sorting list 2 data?
(apologies for long post!)
Steve (Delphi 2007 & XP)