Expression with Switch and OrderBy

Hello AppSheet :slight_smile:

I would like to alphabetize the Suggested_Values constraint for a column using ORDERBY().

I do not know why I am receiving errors. Does anyone else know?

Thank you.

-Tiffany

switch([Route Quickset],

"Mandatory AM Broward",orderby(select(locations[name],and([Route?]="Broward",[Mandatory AM?]="TRUE")),locations[name]),

ORDERBY( row-keys , sort-key [ , descending-order? [ , sort-key ] ]… )

row-keys: select(locations[name],and([Route?]=“Broward”,[Mandatory AM?]=“TRUE”)) GOOD
sort-key: locations[name] INVALID - cannot be a list

sort-key (expression): an expression that produces a sort key for the row. The sort key is compared against the corresponding sort keys of other rows to determine where the row will occur in the sorted list. The expression is evaluated in the context of the row being considered (similar to the match expressions in FILTER() and SELECT() ). The simplest and most common sort-key expression is a reference to the column by which to sort (e.g., [Product Name] or [Start Date] ), but can be more complex.

1 Like

So how do I create a sort-key indicating the alphabet? Thank you.

Please read the help doc.