cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cmanning
Helper III
Helper III

Sorting a Gallery Populated By Two Dataverse Tables Via Lookup Column - Unable to Sort by a Parent Table Column

I am building a canvas app with two Dataverse tables  and I can display items from both tables per the lookup column DRID.  The parent table DealIntakeApp has a text column (Name - contains unique ID) which is referenced in the child table AssignedUsers.DRID lookup column.  Below in the Relationships tab from Dataverse.
Deal Intake App Lookup Col.png
In my gallery (GalleryNewReports) I can reference values from either table per my examples below.  When I reference values from the DealIntakeApp table, I use for example ThisItem.DRID.SFDCOppID, while referencing a value from AssignedUsers table is straightforward. 

// From AssignedUsers table
ThisItem.'Assigned-Full-Name'

// DealIntakeApp table - Used the lookup column DRID in AssignedUsers table, DRID dot syntax 
// to retrieve SFDCOppName values from the DealIntakeApp table  
ThisItem.DRID.SFDCOppName

The Issue: I need to sort the GalleryNewReports by a column in the DealIntakeApp table but I can't use the AssignedUsers.DRID.SFDCOppName method to use in sorting.  What am I missing? 
Here is a visual reference.
DIApp - Reports Gallery multiple tables.png

1 ACCEPTED SOLUTION

Accepted Solutions
cmanning
Helper III
Helper III

For those interested in the solution here it is.

SortByColumns(AddColumns(AssignedUserss, "sortby", DRID.SFDCOppName), "sortby", Ascending)

View solution in original post

5 REPLIES 5
dpoggemann
Super User
Super User

Hi @cmanning ,

 

Can you show example of how your are trying to sort?  Have you tried putting the rows into a Collection sorting the collection to display the records in the GalleryNewReports?

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew

@dpoggemann - Thank you for your response.

 

// Works - I can sort gallery by column but only IF the column is in the AssignedUserss table
SortByColumns( AssignedUserss, "cr4de_assignedfullname" ) 

// Can access items from both tables in the gallery
// Access data in the DealIntakeApp table by using ThisItem.DRID.DealIntakeAppColumnName
ThisItem.DRID.SFDCOppName

// However, I cannot sort by a column in the DealIntakeApp table 
/// THIS IS WHAT I NEED A SOLUTION FOR - SortbyColumns using SFDCOppName

 

 If I used a collection, are they any easier to sort or will I see the same issue?  Can you provide an example of how to create a new collection from two Dataverse tables with a lookup column creating a relationship between the tables?

cmanning
Helper III
Helper III

Anyone know how to sort a canvas app gallery with fields from 2 related Dataverse tables? 

cmanning
Helper III
Helper III

Bump

cmanning
Helper III
Helper III

For those interested in the solution here it is.

SortByColumns(AddColumns(AssignedUserss, "sortby", DRID.SFDCOppName), "sortby", Ascending)

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Users online (1,641)