cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TesDA
Level: Powered On

Reducing Load Time

I'm noticing that the below function seems to slow down the app initially loading, especially for new users. Is there a faster way to filter for the user who logged in, to get their specific data in the gallery?

 

SortByColumns(Search('[dbo].[PS_Time_Leave]', "US"&Office365Users.MyProfile().MailNickname, "USID"),
"USID", If(SortDescending1, Descending, Ascending))

 

I have this in the gallery under Items (see picture below).

 

LoadTime 7-25-19.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Reducing Load Time

You can create a variable in the OnStart that sets the user search value then use that variable in the Items formula.

 

OnStart:

Set(gvSearchCriteria, "US"&Office365Users.MyProfile().MailNickname)

 

Items:

SortByColumns(Search('[dbo].[PS_Time_Leave]', gvSearchCriteria, "USID"), "USID", If(SortDescending1, Descending, Ascending))

 

This way there is only one call to Office365Users instead of one for each row.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
2 REPLIES 2
Super User
Super User

Re: Reducing Load Time

You can create a variable in the OnStart that sets the user search value then use that variable in the Items formula.

 

OnStart:

Set(gvSearchCriteria, "US"&Office365Users.MyProfile().MailNickname)

 

Items:

SortByColumns(Search('[dbo].[PS_Time_Leave]', gvSearchCriteria, "USID"), "USID", If(SortDescending1, Descending, Ascending))

 

This way there is only one call to Office365Users instead of one for each row.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
TesDA
Level: Powered On

Re: Reducing Load Time

@Jeff_Thorpe- Thank you!

Helpful resources

Announcements
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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 244 members 5,130 guests
Please welcome our newest community members: