PDA

View Full Version : Alphabetize or Numerically order a list??


kpsmith
02-24-2003, 02:02 PM
Anyone have any ideas on how to easily alphabetize or Numerically order a Global List, or Delimited String, or delimited text file?

I'm not using this in a listbox object so sort at run time isn't going to do it....

Derek
02-24-2003, 03:29 PM
You could actually use a list box to do this, if yu want to. Resize it to super small and the following actions will work:

Page.Init

%TextFile% =TextFile.Read ("C:\address\textfile.txt")
%NewList% = String.Replace ("%TextFile%", "", "")

Page.Show

ListBoxObject[ListBox1].Add (Start, "%NewList%")
%ItemText% = ListBoxObject[ListBox1].GetItemText (All)
Page.HideObject ("ListBox1")
GlobalList[NewGlobalList].Add (Beginning, "%ItemText%")

Not forgetting to set-up the NewGlobalList to receive the data.

Note: the delimiters are set to #ASC_CR##ASC_LF#
the string replace in Page.Init has blank "Search for" and "Replace With" fields. i guess you could also leave those both to #ASC_CR##ASC_LF#

Dont forget to add
#ASC_CR# - 13
#ASC_LF# - 10
to your 'Constants' in the Configuration Tab of Project setting too.

kpsmith
02-25-2003, 08:15 AM
Thanks Derek. This works wonderfully. IR, wouldn't mind an action in the Global List to Sort Alphabetically/Numerically and another action to remove Duplicate entries.