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 / Creating a CDS view fo...
Power Apps
Unanswered

Creating a CDS view for a Power Apps gallery

(0) ShareShare
ReportReport
Posted on by 664

I have a gallery in Power Apps that is combining data from three separate entities:

  • Customer
  • Customer Details, contains lookup field to Customer. Customer to Customer Details is 1:1
  • Orders, contains lookup field to Customer. Customer to Orders is 1:N

The gallery should show a field from Customers, a field from Customer Details, and the date of the last order they placed from orders. I have accomplished this in my app using AddColumns in the Items property but it is very slow. I used AddColumns instead of looking up the values on the label because I need to sort on the values from Customer Details and Orders.

Is it possible to create a view between these 3 tables? I have only been able to get one on Customer Details and add a field from Customer. Is there something like Join in CDS where I can create the view and pull that into the app instead?

I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Cooper01 

    You should be able to add columns from related entities to a view. Annotation 2020-06-26 142640.png

  • Cooper01 Profile Picture
    664 on at

    How would you go about configuring logic to only add certain rows to the view (i.e. the last order placed)?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Cooper01 

    Sort the view Descending and do a lookup in the canvas app and it will find the last record since Lookup() finds the first matching record but if it is presorted descending, it will actually find the last one.  This technique will avoid possible delegation issues.  

  • Cooper01 Profile Picture
    664 on at

    Thanks for the response. I had a LookUp in my AddColumns function and from my understanding, the app will make the lookup call for each row in the gallery which I am trying to avoid because of the hit to pefromance.  It sounds like building a view of this complexity is not possible.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Cooper01 

    It's not the lookup that adds the lag, it's the AddColumns() because this function is not delegatable.  A lookup does the searching at the server level. 

  • Cooper01 Profile Picture
    664 on at

    In this link I am seeing the following: "When you place a LookUp function on a Label inside of the Gallery, then that LookUp will be performed once for every record in the Gallery. That means if you have 100 records in the Gallery the app has to perform 100 individual LookUp calls to the data source to render."

    Is this out of date?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Cooper01 

    You can test it to see.  Another alternative to providing increasing performance is to cache the lookup tables by running a collection on them either at the OnStart of the app or in the OnVisible property of the screen containing the gallery.  One of my heros @Meneghino  describes this in his blog https://baizini-it.com/blog/index.php/2018/01/11/powerapps-caching-lookup-tables-to-improve-performance/ 

  • Cooper01 Profile Picture
    664 on at

    The statement is consistent with my testing via the monitor tool. Thanks for the link as well, I like that solution too but I have more than 2000 records in my table and based on my understanding that is the max number of records which can be added.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard