Is there a way to automatically sort the Enum...

(Joseph Pentheroudakis) #1

Is there a way to automatically sort the Enum values in a dropdown when that list is populated by looking up another table?

I have a column called Vendor in a table, which Refs a different table called Vendors. The Vendor column looks up the Vendors table and displays the Vendor names as an Enum dropdown. (A very cool feature).

The Vendors table is writable by the user, since they need to be able to add a new vendor in the field as needed. Using the lookup feature means that the next time they encounter that vendor he/she will be on the dropdown list and they won’t have to enter it by hand.

I’d like the dropdown list to be sorted alphabetically. I can sort the Vendors table in the spreadsheet, in which case the names will appear in the right order in the dropdown, but when the user adds a new name that name is appended at the end of the table (and in the dropdown). Not surprising, but I was just wondering if there was a way to sort the list on the fly instead of me sorting the table in the spreadsheet every time a new name is added.

The Vendors lookup table is keyed by the Vendor name.

Thanks!

(Suvrutt Gurjar) #2

Hi +Charlie Wells, You may want to look at latest post by @praveen under Feature of The Week.You may want to try the Sort function mentioned therein.

Request you to put expression such as =SORT(Vendors[VendorReference])

in valid_if of column Vendor where you wish to have a drop down list.

Vendors and VendorReference are respectively lookup table and lookup column in the lookup table where vendor list is stored.

Hope this is what you are looking at and helps.

(Joseph Pentheroudakis) #3

@Suvrutt_Gurjar funny I just saw that too! Very good timing :=). I’ll give it a try. Thank you!

(Joseph Pentheroudakis) #4

@Suvrutt_Gurjar … and it worked beautifully. Thank you and thanks to @praveen and AppSheet!

Best tool ever.

(Suvrutt Gurjar) #5

Hi +Charlie Wells, nice to know the solution worked for you. You are right-AppSheet platform,AppSheet team and AppSheet community are a great combination to work with.

(David Ackling-Jones) #6

Quick question, probably a dumb one: how is Sort() different to Orderby()?

(Suvrutt Gurjar) #7

Hi @David_Ackling-Jones,As per my understanding, the SORT will work on list composed of any column in a table and has a simpler format, Just the list to sort out with possible option of ascending or descending with False/True parameter.

ORDERBY will work only on REF fields. Also ORDERBY has more options like sorting a key value by another column value such as say Date etc.

The List Expression documentation explains it well help.appsheet.com - List Expressions and Aggregates List Expressions and Aggregates help.appsheet.com

(David Ackling-Jones) #8

Ty