Newbies helsing Posted March 3, 2004 Newbies Posted March 3, 2004 Hi, How can I sort items in a field. For example, 10 words are enterd into a field, how can i get those words sorted alphabetically when it comes time to print? I can't find any posts relating to this. Many thanks.
Vaughan Posted March 3, 2004 Posted March 3, 2004 There is no built-in way to do this. A lot depends on how the words are delimited. Delimiting by spaces is probably not going to be much use, as you won't be able to enter word pairs or phrases. Best use commas or returns. You could copy the text to a global field then perform a scripted "ripple sort" on the string. It's been years since I did a ripple sort (that was in 1982 using Basic). I'll leave it to others to fill in the minor details.
BobWeaver Posted March 3, 2004 Posted March 3, 2004 Set up a self join relationship based on a unique record ID such as serial number. So, each record relates exactly to itself. Then make a value list based on this relationship using the values from the field you want to sort. Then, to sort the items, just execute a script that sets the field contents to the ValulistItems() function using that valuelist. See attached file. In this example you have to have the items delimited with carriage returns. If you want to use commas or spaces, then You will have to create an intermediate calculated field which substitutes your delimiter character with a paragraph marker. Like so: ConvertedData = Substitute(FieldtoSort, ","," SortFieldItems.fp5.zip
Vaughan Posted March 3, 2004 Posted March 3, 2004 A value list will remove duplicate entries... New York London Gosford London ... will become... Gosford London New York ... which may or may not be OK.
Newbies helsing Posted March 4, 2004 Author Newbies Posted March 4, 2004 Hi BobWeaver, Sweet. Works great. Thanks!
Recommended Posts
This topic is 7839 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now