web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SortByColums : Sort a ...
Power Apps
Answered

SortByColums : Sort a LookUp column

(0) ShareShare
ReportReport
Posted on by 83

Hi there 😀

 

I have a list of invitations, that contains a LookUp column for contacts.

I need to get the 'Full Name' column of the related contacts, to filter the list of invitations.

 

Here is my old formula, I sorted my results using a column containing the 'Full Name', automatically extracted from the Contacts. The company I work with deleted this extracted column named "rcr_name".

 

When I put Contact.'Full Name' to replace "rcr_name", it doesn't work.

 

SortByColumns( 

 Filter(
 'Days Attendance';
 StartWith(Contact.'First Name') ¦¦ StartWith(Contact.'Last Name');
 );

 "rcr_name";
 If(SortDescending1;Descending;Ascending)
)

 

Do you have an idea how to sort by Contact.'Full Name' please ?

 

Thanks in advance 😉 😁

Have a good day !

I have the same question (0)
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Romsteck ,

    Could you tell me what is your data source?

    I assume that you use CDS.

    Firstly, I'm afraid it's not supported to use lookup field in SortByColumns function.

    I suggest you use AddColumns function to shape your table.

    Try this formula:

    SortByColumns( 
    
     AddColumns(
     Filter(
     'Days Attendance';
     StartWith(Contact.'First Name') ¦¦ StartWith(Contact.'Last Name');
     );
     "fullname";Contact.'Full Name' 
     //contact is the lookup field name, 'Full Name' is one field in related Contact entity
     );
    
     "fullname";
     If(SortDescending1;Descending;Ascending)
    )

    Using AddColumns function will not effect your data source's data, it just shape table temporarily.

     

     

    Best regards,

  • Romsteck Profile Picture
    83 on at

    Hi @v-yutliu-msft ,

     

    Thank you very much for your answer, yes I use CDS.

    I can now sort my gallery.

     

    However, I have a patch toggle that uses This Item to find the record, but it doesn't work after that...
    There is an error at "ThisItem"..

     

    Do you have an idea ?

     

    Thanks 😁

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Romsteck ,

    Since the gallery's data source have changed to the table that you shaped (AddColumns(....)), so using ThisItem means that the item in the new shaped table ,not the original table.

    I suggest you use an unique field to filter and then update.

    For example, Id field is your unique field.

    You could set patch formula like this:

    Patch(entity,LookUp(table,Id=ThisItem.Id),{....})

     

     

    Bets regards,

  • Romsteck Profile Picture
    83 on at

    hi again @v-yutliu-msft ,

     

    Perfect, it works great !

     

    Thanks ! 😉

     

    Have a good day !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard