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
Level 10

Re: Performance issue

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
Level 10

Re: Performance issue

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
Level 10

Re: Performance issue

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

Re: Performance issue

 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
Level 10

Re: Performance issue

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

Re: Performance issue

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
Level 10

Re: Performance issue

@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

Re: Performance issue

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
Level 10

Re: Performance issue

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

Re: Performance issue

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
Level 10

Re: Performance issue

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 179 members 4,535 guests
Please welcome our newest community members: