cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate II

SortByColums : Sort a LookUp column

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 !

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: SortByColums : Sort a LookUp column

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: SortByColums : Sort a LookUp column

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Advocate II
Advocate II

Re: SortByColums : Sort a LookUp column

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 😁

Highlighted
Community Support
Community Support

Re: SortByColums : Sort a LookUp column

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate II
Advocate II

Re: SortByColums : Sort a LookUp column

hi again @v-yutliu-msft ,

 

Perfect, it works great !

 

Thanks ! 😉

 

Have a good day !

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (3,502)