cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EMohaisen
Helper I
Helper I

Filter gallery items based on login user (Very Slow!!)

Hello All, @RandyHayes  

 

I am trying to filter a gallery items based on login user.

I have 2 "Person or Group" fields (Employee & Hirining Manager) from the SharePoint list.

so i would like to see all items where my name is in the hiring manager field or if my name is in the Employee field.

 

I used the following formula but it's very very slow loading the items.. any ideas please?

 

 

Filter(
'NAEOOP Master List',
Or(
'Hiring Manager'.Email = Office365Users.MyProfile().Mail,
'Employee (AD)'.Email = Office365Users.MyProfile().Mail
)
)

 

I tried as well to use the following filter but it's not working:

 

Filter(
'NAEOOP Master List',
Or(
'Hiring Manager'.Email = User().Email,
'Employee (AD)'.Email = User().Email
)
)

 

 

Note: the following will return from my Organization:

Office365Users.MyProfile().Mail => firstname.lastname@company.com

User().Email => Username@company.com

 

Thanks for your help!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@EMohaisen 

Seems unusual that you would be seeing two different email addresses from those functions unless there are multiple aliases assigned to the user.

But at any rate...you really don't want to put those functions in a formula like that as they will slow things down.

Consider putting the correctly returning value in a variable and use that instead - this is usually done in the OnStart of the App as an easy place to do this.

   Set(MyProfileEmail, Office365Users.MyProfile().Mail)

Then in your Filter:

Filter(
    'NAEOOP Master List',
     Or(
       'Hiring Manager'.Email = MyProfileEmail,
       'Employee (AD)'.Email = MyProfileEmail
       )
)

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@EMohaisen 

Seems unusual that you would be seeing two different email addresses from those functions unless there are multiple aliases assigned to the user.

But at any rate...you really don't want to put those functions in a formula like that as they will slow things down.

Consider putting the correctly returning value in a variable and use that instead - this is usually done in the OnStart of the App as an easy place to do this.

   Set(MyProfileEmail, Office365Users.MyProfile().Mail)

Then in your Filter:

Filter(
    'NAEOOP Master List',
     Or(
       'Hiring Manager'.Email = MyProfileEmail,
       'Employee (AD)'.Email = MyProfileEmail
       )
)

I hope that is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes Thanks a LOT!! 

 

Yes, it works very well !! i really appriciate your quick help.

 

Excellent!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,512)