cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Performance issue

Could someone please help me in solving performance issue in apps?

 

I connected office 365 data and my app became too slow in retrieving data.

 

Sometimes it shows error.

 

PA.png

 

Thank you!

2 ACCEPTED SOLUTIONS

Accepted Solutions
Meneghino
Community Champion
Community Champion

Hi, Office 365 Users is somewhat slow, I have noticed.

 

What is making matters worse is that the app makes a call to the service for every line in your projects list, even if the same person has been looked up before in a previous line.

 

You can improve your app design by caching the project manager data in a collection and then doing the lookup to the collection.  This way you do the calls to the Office 365 Users service once up front and then go at lightning speed with the cached collection in the rest of the app.

 

Here is how you do it, for example.

 

1) Have a welcome screen to your app with company logo, and a button to "Proceed"

 

2) Set the OnSelect property of the Proceed button to something like this:

ClearCollect(CachedProjectManagers, AddColumns( RenameColumns(GroupBy (MyListOfProjects, "Projectlead", "AllRows"), "Projectlead", "PersonID" ), "PersonName", Office365Users.UserProfile(PersonID).Displayname)); Navigate (MyScreen, None)

3) In the expression in your screenshot use instead

LookUp(CachedProjectManagers, PersonID = ThisItem.Projectlead, PersonName)

 

PS There is a draw-back: since GroupBy is (not yet!) delegated then this will work if all your project managers appear in the first 500 rows of your projects list, but this could well be the case

View solution in original post

Meneghino
Community Champion
Community Champion

Yes, I suggest that you have Microsoft Flow to add rows to the a user table stored in dbo (ProjectManagers) when a new project is added and the project manager is not already present in ProjectManagers.

Please let me know if you need guidance in this.

View solution in original post

11 REPLIES 11
Meneghino
Community Champion
Community Champion

Hi, Office 365 Users is somewhat slow, I have noticed.

 

What is making matters worse is that the app makes a call to the service for every line in your projects list, even if the same person has been looked up before in a previous line.

 

You can improve your app design by caching the project manager data in a collection and then doing the lookup to the collection.  This way you do the calls to the Office 365 Users service once up front and then go at lightning speed with the cached collection in the rest of the app.

 

Here is how you do it, for example.

 

1) Have a welcome screen to your app with company logo, and a button to "Proceed"

 

2) Set the OnSelect property of the Proceed button to something like this:

ClearCollect(CachedProjectManagers, AddColumns( RenameColumns(GroupBy (MyListOfProjects, "Projectlead", "AllRows"), "Projectlead", "PersonID" ), "PersonName", Office365Users.UserProfile(PersonID).Displayname)); Navigate (MyScreen, None)

3) In the expression in your screenshot use instead

LookUp(CachedProjectManagers, PersonID = ThisItem.Projectlead, PersonName)

 

PS There is a draw-back: since GroupBy is (not yet!) delegated then this will work if all your project managers appear in the first 500 rows of your projects list, but this could well be the case

View solution in original post

Anonymous
Not applicable

 I did the same thing which you suggested and it worked for me but every time when I click "Proceed" button it takes minimum 5 mins which are too long for the user.

 

Kindly advice is there any additional solution.

Capture.PNGCapture1.PNG

Meneghino
Community Champion
Community Champion

Hi @Anonymous

 

Let's do a quick test to see if it is the GroupBy or the Office365Users that is slowing things down with the Proceed button.  First of all, how many rows are returned into CachedProjectManagers?  You can check this with a text box with simply CountRows(CachedProjectManagers)

 

Then please check how long it takes for both of these, instead of the current 5 minutes and post back.

 

Test A, without User365

 

ClearCollect(CachedProjectManagers, AddColumns( RenameColumns(GroupBy ('[dbo].[M202_Projects]', "Projectlead", "AllRows"), "Projectlead", "PersonID" ), "PersonName", "John Smith")); Navigate(Home, None)

 

Test B, where please replace XYZ below with the actual number of count of the rows from above

 

ClearCollect(CachedProjectManagers, AddColumns( RenameColumns(FirstN ('[dbo].[M202_Projects]', XYZ), "Projectlead", "PersonID" ), "PersonName", Office365Users.UserProfile(PersonID).DisplayName)); Navigate(Home, None)

 

 

PS I suspect that A will be much quicker and B will not be much less than 5 minutes...

Anonymous
Not applicable

Count of CountRows(CachedProjectManagers) = 59

 

With Test A:

I get wrong numbers in total projects also all the project owner name is mine as I mentioned it in the function.

 

Capture1.PNG

 

With Test B:

 

I am getting error in the function

 

Capture.PNG

Meneghino
Community Champion
Community Champion

@Anonymous

 

For Test A, you are getting the result we expect.  The important thing is: how long did it take for the proceed button to work compared to the 5 minutes from before?

 

For Test B I am not sure why it is not working, but if Test A is quick enough then it does not matter.

 

How much time for test A?  If short then the solution will depend on how often you have to add new project managers.

 

If once or twice a year then I suggest you make a local table of project managers, if more often the I would suggest you make your own table of project manager IDs and name in dbo and have a simple app to group the projects and save the names.

 

Please let me know about the time for test A and if you need any help with the suggested approaches.

Anonymous
Not applicable

Test A took very few seconds...

 

Project owners will be added very often which means New projects will be added often and when a user is adding new projects they will mention Project owner mail id. We have to look up project owner mail id to find project owner name with the help of office 365 data.

 

The reason why I cannot maintain local table is because there might be new employee added to office 365 data (in my organization) anytime.

 

Any suggestions on this?

Meneghino
Community Champion
Community Champion

Yes, I suggest that you have Microsoft Flow to add rows to the a user table stored in dbo (ProjectManagers) when a new project is added and the project manager is not already present in ProjectManagers.

Please let me know if you need guidance in this.

View solution in original post

Anonymous
Not applicable

I was experimenting with local table data. Here is my table name "[dbo].[Active_Directory]". and function is here ClearCollect(CachedProjectManagers1, AddColumns(RenameColumns(GroupBy('[dbo].[M2020_Projects]',"Projectlead","AllRows"),"Projectlead","PersonID"),"PersonName",'[dbo].[Active_Directory]'.EMAIL_ADDRESS));Navigate(Home,ScreenTransition.None) but getting below error.

 

Anything I am missing here?

 

xx.png

Meneghino
Community Champion
Community Champion

Yes, it is CountRows not Count, which works a little differently

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,104)