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

How does PowerApps bundle the Call to the SharePoint list?

I inherited an app where the User selects a record from a Gallery connected to a SharePoint list.  The record's ID is being set to a variable.  That variable is then being used in a 100-ish fields where the field Default Property is being set with 

 

LookUp([SharePointList], varItem.ID = ID, [FieldName])

 

My question is this:  Does PowerApps make a Call for every LookUp for every field with the code above?  Or is it bundling the Calls somehow so that PowerApps is reaching out the List only 1 time...or a few times....

 

Does any of that make sense?  Ultimately, the App has some User perceived consistency issues with either saving or displaying data, and I'm trying to investigate this area as a possibility of the problem.

2 ACCEPTED SOLUTIONS

Accepted Solutions
poweractivate
Most Valuable Professional
Most Valuable Professional

@JHenAptive 
If same LookUp is repeated again then call to data source would be repeated again each time
Recommend to set variable

Set(gloMatchingRecord,LookUp(yourSharePointList,lookup criteria here...));

 

Make sure to use ShowColumns for any columns not in your criteria, otherwise you won't see the columns, Power Apps uses explicit column selection by default now.


Set(gloMatchingRecord,ShowColumns(LookUp(yourSharePointList,lookup criteria here...),columns to show here);


However, issue is that a global variable must be overwritten each time.
if wanting to modify the Record later in-memory, a Collection, even if usually for multiple Records, may be better here.


ClearCollect(colMatchingRecord,LookUp(yourSharePointList,lookup criteria here...));


Then to Patch to the first Record


Patch(colMatchingRecord,First(colMatchingRecord),{columns to change in memory});


Then to patch to the data source:


Patch(yourSharePointList,LookUp(yourSharePointList,lookup criteria here...),First(colMatchingRecord))

 

When Patching only one Record to a Data Source, if the ID (primary key) is still present in colMatchingRecord itself, we may leave out the 2nd argument of Patch in this case and use the 2-arg version of Patch to avoid the extra LookUp (however careful. If the ID is missing, then this creates a new record instead):

 

Patch(yourSharePointList,First(colMatchingRecord))


See if something like this may help to understand it better @JHenAptive 

View solution in original post

Hi @JHenAptive,

 

Each LookUp will result in an API call to SharePoint. Since you already save the record to a variable, I am not sure why a new LookUp is needed to fetch a particular column.

 

Try to avoid similar LookUps by saving that to a variable when needed (e.g. OnVisible, OnStart...) and display the column via varVariableName.ColumnName

 

If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

Thanks!

View solution in original post

6 REPLIES 6
poweractivate
Most Valuable Professional
Most Valuable Professional

@JHenAptive 
If same LookUp is repeated again then call to data source would be repeated again each time
Recommend to set variable

Set(gloMatchingRecord,LookUp(yourSharePointList,lookup criteria here...));

 

Make sure to use ShowColumns for any columns not in your criteria, otherwise you won't see the columns, Power Apps uses explicit column selection by default now.


Set(gloMatchingRecord,ShowColumns(LookUp(yourSharePointList,lookup criteria here...),columns to show here);


However, issue is that a global variable must be overwritten each time.
if wanting to modify the Record later in-memory, a Collection, even if usually for multiple Records, may be better here.


ClearCollect(colMatchingRecord,LookUp(yourSharePointList,lookup criteria here...));


Then to Patch to the first Record


Patch(colMatchingRecord,First(colMatchingRecord),{columns to change in memory});


Then to patch to the data source:


Patch(yourSharePointList,LookUp(yourSharePointList,lookup criteria here...),First(colMatchingRecord))

 

When Patching only one Record to a Data Source, if the ID (primary key) is still present in colMatchingRecord itself, we may leave out the 2nd argument of Patch in this case and use the 2-arg version of Patch to avoid the extra LookUp (however careful. If the ID is missing, then this creates a new record instead):

 

Patch(yourSharePointList,First(colMatchingRecord))


See if something like this may help to understand it better @JHenAptive 

Hi @JHenAptive,

 

Each LookUp will result in an API call to SharePoint. Since you already save the record to a variable, I am not sure why a new LookUp is needed to fetch a particular column.

 

Try to avoid similar LookUps by saving that to a variable when needed (e.g. OnVisible, OnStart...) and display the column via varVariableName.ColumnName

 

If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

Thanks!

I agree, a new LookUp isn't necessary.  The app show clear signs of a beginner learning curve, so I feel for the original developer.  

I wanted to double check the API Call backend before I started to swap all of the fields to something like you pointed out with varVariableName.ColumnName...

 

...because well....the users of the SharePoint list have also named the field names with user friendly titles that contain spaces and special characters....so my field names are all "Odata__x300....." or '__x2000__Column__x2000__Name'....  so each time I want to change the code, I have to look up the field name in the List Settings.  So, it's going to be a slow process.

Thanks for the info.

 

@JHenAptive Nice. Just keep in mind Power Apps uses the Explicit Column Selection setting on by default (and you should leave it on). NOTE: applicable to Dataverse, SQL Server, etc. only as of this writing, NOT applicable to SharePoint List!

poweractivate_0-1691606602861.png

 

That means whenever you do a Filter or LookUp, ONLY those columns are returned in the Record (LookUp) or Table (Filter) result. This is a very good thing. However, suppose you want your ID to be in the Record. If it wasn't in your criteria, it may be missing from the Record (or each of the Table's Records).

This is where using ShowColumns wrapped around the LookUp or Filter may be very powerful.

However, only use ShowColumns to show the specific columns you're really using in the app, or performance may be degraded unnecessarily.
As you rightly pointed out, if the LookUp is being repeated again by the developer, that is an extra data source call. It is hard to optimize it and required lot of attention to detail. Besides this, beware of common pitfalls:

- Same Filter or LookUp repeated again TWICE or more inside If: This should be converted to keep the If inside same Lookup / Filter

- Patch inside ForAll, Collect inside ForAll. Common  pitfalls.

Should instead be Patch outside ForAll, ClearCollect outside ForAll.

And so forth.

 

timl
Super User
Super User

Just to clarify - the target data source must support Explicit Column Selection for Power Apps to apply this feature. Currently, SharePoint does not support Explicit Column Selection. The 2 main datasources that do support Explicit Column Selection are Dataverse and SQL Server.

poweractivate
Most Valuable Professional
Most Valuable Professional

@JHenAptive  Yes, @timl is correct for SharePoint List. It is still not supported for SharePoint List. It may not be in the future either. It is only for data sources like Dataverse and SQL Server
For example if I have a SharePoint List like this:

poweractivate_0-1691613703566.png

And a formula like this

poweractivate_1-1691613735604.png

 

Upon clicking Run OnStart:

poweractivate_0-1691255080659.png

 


The Collection shows all the columns, not just the ones in the LookUp.

In my case I had only Title in the LookUp.

If Explicit Column Selection were working on a SharePoint List, I should only see the Title, not all of the columns.

 

so you are right @timl , SharePoint List as of this writing, are still not supporting Explicit Column Selection yet, and it may not in the future as well as it is probably only supported for data sources like Dataverse or SQL Server.

So @timl is correct, for your case @JHenAptive you should not worry about the Explicit Column Selection.

 

However, if you ever are considering to use Dataverse in the future, or any other kind of data source which may support Explicit Column Selection, you should be proactive and potentially be already concerned about writing the formulas as if they were explicitly selecting columns, now, to make moving over to Dataverse later much easier.

 

You can also simply turn off the Explicit Column Selection feature and use Datavers without it on until you can rewrite all the formulas, but I recommend leaving the setting on.

 

If you're pretty sure you may stick with SharePoint, then I recommend not worrying about it.

 

However, you may get performance concerns when you have a large amount of columns, like maybe hundreds of them for example in a SharePoint List, this is because ShrePoint List, as @timl mentioned, does not currently support Explicit Column Selection. Even in the hundreds of columns I am often OK with using SharePoint List on my end but depending how many Records, how many Lists you are using and how many columns each list has, how you are using the formulas, etc. you may start getting issues at the higher end of number of columns.

 

You may have to break into separate SharePoint Lists that have fewer columns when this happens to improve performance.

 

If it gets too unwieldy to manage you may want to look at Dataverse, or moving some of it over to Dataverse and keeping the SharePoint List for others (Canvas Apps support using multiple data sources at the same time).,  making sure to keep the Explicit Column Selection setting on to best leverage Dataverse.

 

However, SharePoint List is very powerful, so I may be able to continue using SharePoint Lists, even when some others may already consider to move to Dataverse.

 

However, whenever the concern first arises to use Dataverse, it's often best to act on that initial hunch, as in the long run it may be easier to manage in Dataverse, and the extra cost of Dataverse is usually less than the cost of the troubles one may encounter when not acting on that initial hunch.

 

I am probably biased towards keeping SharePoint Lists, even when it may actually be better to move to Dataverse, as often there is a lot of desire to avoid Dataverse and avoid the extra licensing cost.

 

However I have found in most cases, I would say the extra cost of Dataverse is actually much less than the cost of the extra maintenance overhead, and having to use advanced techniques, when keeping SharePoint Lists. So when people tend to try and save money not using Dataverse, they may be paying more in the long run (and even in the short run) by working so hard to keep the SharePoint Lists.

 

Nonetheless, SharePoint Lists are so powerful, that I may keep them well before moving to Dataverse, and I recommend you start with SharePoint Lists first. 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (768)