cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MH3
Post Prodigy
Post Prodigy

Filtering Gallery Items as per the Logged in Office 365 User

Hello,

I am developing an application called Activity Time Log, and I am using Excel as my DataSource (for Temporary Purpose).

I am having a problem, when I was test running the app with my O365 User ID, The gallery items shown my UserName and related field which is correct as my perspective, but when I given the app access to my organization 0365 users, the gallery still shows my data items which I had created while testing and I have also created the User Field in the excel file as well.

 

is there any way to filter the gallery as per the logged in user in the app and show them their gallery items not the other users items, right now I am able to filter it with the date picker, I have to Filter by the Logged in User and DatePicker together.

Gallery.jpg

Any Help

@v-siky-msft @WarrenBelz 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @MH3 ,

I was showing you a much easier way and more reliable way to do both filters.

Firstly I do not use the Office365UserProfile filter, so I cannot guide you here, but if the filter works for you, then the below code should work. The same goes for comparing two dates - turning them both into text is one way, but I use a much less complex formula as shown previously. So if your filters are correct, this should work

Filter(
   Table3,
   YourNameField = Office365Users.UserProfile(User().Email).DisplayName && 
   Text(Date,"[$-en-US]dd/mm/yyyy") = Text(DatePicker2.SelectedDate,"[$-en-US]dd/mm/yyyy")
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @MH3 ,

Assuming you are wanting to match the user's name with the name and date fields I can see in your gallery (I will use YourNameField and YourDateField - change these in the code below). Note neither of these filters are Delegable, so large data sets may be an issue.

Filter(
   Table3,
   YourNameField = User().FullName && 
   DateDiff(
      DatePicker2.SelectedDate,
      YourDateField,
      Days
   )=0
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Hi @WarrenBelz ,

 

Let me clear you few things,

while creating Form, I am getting the User Name as a Default Value: in Default Property

Office365Users.UserProfile(User().Email).DisplayName

and Showing it to the gallery as ThisItem.User.

Now, I tried to filter the gallery by using this formula:

Filter(Table3,Office365Users.UserProfile(User().Email).DisplayName)

as this formula is used when I am getting the name of the logged in user.

 

 I have added the Date Picker and used this formula to filter the gallery by Date in the Gallery,

Filter(Table3,Text( Date, "[$-en-US]dd/mm/yyyy" ) = Text(DatePicker2.SelectedDate,"[$-en-US]dd/mm/yyyy"))


will your formula still work? or need some alteration which will include both Date and User Filter.

 

Kindly Check!

 

 

Hi @MH3 ,

I was showing you a much easier way and more reliable way to do both filters.

Firstly I do not use the Office365UserProfile filter, so I cannot guide you here, but if the filter works for you, then the below code should work. The same goes for comparing two dates - turning them both into text is one way, but I use a much less complex formula as shown previously. So if your filters are correct, this should work

Filter(
   Table3,
   YourNameField = Office365Users.UserProfile(User().Email).DisplayName && 
   Text(Date,"[$-en-US]dd/mm/yyyy") = Text(DatePicker2.SelectedDate,"[$-en-US]dd/mm/yyyy")
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

well @WarrenBelz ,

I used exactly same formula as you provided, I'm gonna check it out, then I'll let you know.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,887)