Jump to content
Sign in to follow this  
Flappy

Sorting Value Lists

Recommended Posts

I am working on an application for garments and I want to use a drop down list in the user interface for garment sizes. My problem is mostly aesthetic in that I cannot figure out a way to sort the sizes into the logical order they come in. I need to use related records because the sizes vary depending on the garment, so using custom values doesn't work, though in my example I use one to show what I am hoping to accomplish. Any ideas ?

Size_Example.fp7.zip

Share this post


Link to post
Share on other sites

With a short value list (up to around 100 values) you could use something like this.

Note that the SortBy field should be a calculation, but I don't have the time to do it now.

Size_ExampleMod.fp7.zip

Share this post


Link to post
Share on other sites

Brilliant! Thanks. I knew it had to be something like that, but it has escaped me.

Share this post


Link to post
Share on other sites

Comment,

I've run into pretty much the same problem, with a slight variation... The field in question (using a Pop-Up Menu) needs to store a foreign key that the user shouldn't see. Therefore, my value list (based on a related table) is set to only display values from a 2nd field (eg. department), which is something more descriptive to the user. I believe this is pretty standard operating procedure in FM development.

Problem is, it seems to me this doesn't really leave any way to sort the value list using a method similar to the one you've given. Once I select the option to "Show values only from second field" I only have one option of field to sort by, and since that's the field that I want the users to see, I can't very well use invisible spaces in that field. I need an option for a 3rd field ;)-)

One solution I've thought of is to NOT use the foreign key as the 1st field of the value list, and instead use the descriptive field. I could then use your sorting method, and then when the user saves the record, use a script to set the foreign key based on the chosen value. I wouldn't normally like to do something like this, but in this particular case it might be OK.

Any other suggestions?

Thanks in advance

Jason

Share this post


Link to post
Share on other sites

Value lists are a simple solution to a simple problem. I'd suggest you graduate to a more flexible method, such as scripted selection from a portal or from a list view in a new window.

Share this post


Link to post
Share on other sites

Yeah, I'm familiar with those other options, but I was really hoping to just find some way to use a value list in these cases where I'm dealing with a very small record set for the value list.

Anyway, I appreciate your reply.

Share this post


Link to post
Share on other sites

There's nothing that you haven't already discovered, I'm afraid. If you like, you can make the department name serve as the key - with the inconvenience of handling a potential name-change by a script.

Share this post


Link to post
Share on other sites

I have been struggling with this too - want to use the value list in a drop down but sorted - not alphabetically.

Closest I have found is to reverse the order of the fields in a value list so that the sort field is the second field displayed. By making the sort field a long series of blanks with the sort number appended at the end then the sort number doesn't appear within the field on the layout - though it does appear within the drop down which still looks ugly.

I feel there must be an obvious answer out there somewhere ...

Share this post


Link to post
Share on other sites

Ah, got it now. Couldn't see the spaces in your sort field. But now it works. Thanks.

Share this post


Link to post
Share on other sites

Couldn't see the spaces

That's kinda the idea behind this. :P

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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