cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sperry1625
Solution Supplier
Solution Supplier

SharePoint List Form: Sorting Lookup Column Choices

I have a list that contains three lookup columns.

  1. AppId - Lookup to Applications list
  2. RequestTypeId - Lookup to Request Types list
  3. MetadataTypeId - Lookup to Metadata Types list

The RequestType Id is filtered by the selection of the AppId. My Items setting is as follows:

 

Filter( Choices([@'Testing Lookups'].RequestTypeId), Value in Filter('Request Types',Application.Id = gblAppID).'Name (Title)')

 

This works fine. The problem I am having is I want to sort the selections.  The Request Types table has a column called Order. This is just a numeric field.  I have tried wrapping the above in a Sort() but it does not recognize the Order column name. I have tried adding it as part of the RequestTypeId Lookup column definition but that doesn't work.

Any help or guidance would be greatly appreciated.

Thank you.

Regards,

-S

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Dual Super User
Dual Super User

Hi @sperry1625 ,

 

As it looks, your formula result is a collection of Choices. By default, the function Choices() returns a collection with 2 columns (ID, Value) and that's why the system can't recognize your column Order.

So i kept your formula unchanged and I added the necessary info to it for a succesfull Sort()

 

Sort(
         AddColumns(
                           Filter( Choices([@'Testing Lookups'].RequestTypeId),  
                           Value in Filter('Request Types',Application.Id = gblAppID).'Name (Title)'),
                           "Order",

                           LookUp('Request Types',RequestTypeId=Value,Order)

                           ),

        Order,
       Ascending
)

 

Hope it helps !

View solution in original post

1 REPLY 1
gabibalaban
Dual Super User
Dual Super User

Hi @sperry1625 ,

 

As it looks, your formula result is a collection of Choices. By default, the function Choices() returns a collection with 2 columns (ID, Value) and that's why the system can't recognize your column Order.

So i kept your formula unchanged and I added the necessary info to it for a succesfull Sort()

 

Sort(
         AddColumns(
                           Filter( Choices([@'Testing Lookups'].RequestTypeId),  
                           Value in Filter('Request Types',Application.Id = gblAppID).'Name (Title)'),
                           "Order",

                           LookUp('Request Types',RequestTypeId=Value,Order)

                           ),

        Order,
       Ascending
)

 

Hope it helps !

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (3,578)