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

Power apps using collections, forms and improving performance

I am working on an app for a program where users are presented with a Home screen/dashboard. From here they can add a goal(Add goal page w/ a form), or edit a goal (Edit goal page w/ a form). 

 

To improve performance I have App OnStart that runs so that goals are filtered to just the user.

Collect(MyGoalsCollection,Filter('Goal tracker',SPName.Email=User().Email))

 

For each form,

The button OnSelect is:

SubmitForm(AddGoalForm);Navigate(Home)

The  OnSuccess code is.

Notify("Changes successfully submitted. It will take a few moments for this item to display on your Home page dashboard.",Success);
Collect(MyGoalsCollection,AddGoalForm.LastSubmit);
ResetForm(AddGoalForm)

 I also have a PowerAutomate that puts the current users SharePoint name in the SPName field.

 

The issue I'm running into is that when the user creates, or edits their goal:

  • it takes a while to display on the dashboard
  • If it doesn't display right away and the user refreshed the page they have to refresh multiple times.

 

ASK: Is there a way to improve this performance? Perhaps rather than running a PowerAutomate to capture the users SPName, is there an automatic way to capture that in the form so the user doesn't need to?

9 REPLIES 9
Drrickryp
Super User
Super User

@Jltitus ,

In your OnStart use Set(UserEmail,User().Email)) and use the global variable, UserEmail throughout your app if needed. I'm not sure that your collections are necessary.  Why not just use the lists themselves.  Your needing to refresh the collections will take time. 

 

I'm using collections because the number of items could exceed the 2K of items in the SharePoint list that the app would have to filter. I understood that collections would support better user experience in that case.

Drrickryp
Super User
Super User

@Jltitus 

Filter() is delegatable while Collect and ClearCollect still limit at 2k. If your are prefiltering your list to the user, will it actually exceed 2k items?  Using the global variable will greatly improve performance at the start of the app.

No one user will exceed 2K.. so should I not use collection in that case?

Drrickryp
Super User
Super User

@Jltitus 

It should not be necessary.  Try it without them in your galleries and forms. I think you are likely making things more complicated than they need to be.  Use delegatable functions and there shouldn't be a problem.  

TheRobRush
Super User
Super User

I am not sure how long it is taking for your gallery to refresh and show them what they have entered. In my experience it can take anywhere from 2 to 5 seconds for the calls to the datasource to start returning the fresh data. If that's the time frame you are experiencing I'd say its about right, and only way to improve it outside of upgrading your network would be to have your DISPLAY also based on the local collection you stored in the start of app, then when they add or edit save it in the local storage, and have a timer in the back that every x seconds checks to see if local storage matches splist data, and if not updates the splist and recollects it locally. This way it would display instantly since you would be making your edits locally and displaying that data for end user instead of waiting for it to call on the sharepoint list for visual changes. Same result just much faster for the user

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

@Drrickryp Thanks so much, I'm updating to not use collections to see how that plays out. 

I'm thinking that rather than collecting and filtering by SPName(which I need to run Power Automate to get, I can delete SPName from my list and use the created by field but I'm having issues when filtering my gallery to only display those items where the created by is the current user, Do you have a recommendation? Below is the code using the SPName.

Sort(Filter('Goal tracker',SPName.Email=User().Email),GoalName,Ascending)

 

Figured it out 🙂

excellent, be sure to post here what helped you so if someone else has the issue and finds your post they will get an answer

 

_____________________________________________________________________________________
Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
This helps others find solutions to future issues!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,824)