Jump to content
Server Maintenance This Week. ×

Sorting items in a field


This topic is 7358 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

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.

Link to comment
Share on other sites

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. wink.gif

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 7358 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.