sort string

ecl

New Member
anyone know a quick sort solution ?

From a txt file i get a unsorted string (like ",d,e,f,a,z,g,y")
The items will be used in a combobox.
normally i would use
ASSIGN c_somecb:list-items = vString.

but then the list is unsorted.
before assign i would like to sort the items.

tks in advance
(progress82c)
 
If you need to sort the string itself, populate a temp-table with one record per entry and then read it back out using an index or BY phrase.

If you only need to sort the combo-box, you can set the SORT attribute of the combo to TRUE any then use list-items in any order. You can only set this attribute before the combo has been realised.
 
ah, sort attribute might do the trick, never used it, will try.

The temp-table solution could cause some performance problems.
The example was very small, sometimes the string contains 200 items of 0 to 25 chars each.
 
Even with a few hundred records, the TT solution won't be massively slow. But I don't know if it will be problematic for you - depends on where and how often it would be used in your system I suppose.
 
The temp-table approach is almost certainly going to be faster and have less overhead than anything you could write yourself.
 
the SORT attribute turned out to be sufficient,
and also the TEMP-TABLE approach was better then i expected.

(even running it on a computer PII-233Mhz with WinNT4 !
a truly remarkable machine, still running, apart from one general power-failure is has been running for 11 years now )

tks for sharing ideas
 
Back
Top