cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
omelo
Frequent Visitor

Filtering a gallery by user's location

I'm creating a visitor register app, the data source is a SP list.

I'm capturing the office with a person column, the display field is "office"

On the app I have an admin page, where I need to filter the visitors gallery  based on the office of the admin that is logged in.

The idea is that the admin can mass "Check Out" visitor for their own office.

 

When I select the office field in powerapps, there is no option to select office, it shows display name, email, claims , department and image but there is no office.

 

I've tried adding the O65 connector and I managed to get the office location of the logged in user, but have not been able to come up with the filter gallery sintax.

 

This is the filter expression I have working so far, I need to add the office portion. I've tried like hundred different expressions and I don't get the expected results

 

If(Dropdown2.Selected.Value = "All",Filter(VisitorRegister, Created>=Today()-2),
Dropdown2.Selected.Value = "Open",Filter(VisitorRegister, Created>=Today()-2 && IsBlank(CheckOut)),
Dropdown2.Selected.Value = "Closed",Filter(VisitorRegister, Created>=Today()-2 && !IsBlank(CheckOut)))

 

I would appreciate if some one can help me.

Thank you

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Thorpe
Super User
Super User

The issue is that the SharePoint people/group column doesn't store the Office location. The "show field" property of the people/group column in the SP list allows you display different attributes about the user in the list view but the majority of those aren't stored as field data. You might want to think about adding a separate office location field to your form that is a text field in the SP list and you can auto populate it with an O365User call in the PowerApps form when the visitor registers. Once you have the data in a text field you will be able to filter with out any issues.



--------------------------------------------------------------------------------
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.

View solution in original post

2 REPLIES 2
Jeff_Thorpe
Super User
Super User

The issue is that the SharePoint people/group column doesn't store the Office location. The "show field" property of the people/group column in the SP list allows you display different attributes about the user in the list view but the majority of those aren't stored as field data. You might want to think about adding a separate office location field to your form that is a text field in the SP list and you can auto populate it with an O365User call in the PowerApps form when the visitor registers. Once you have the data in a text field you will be able to filter with out any issues.



--------------------------------------------------------------------------------
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.

View solution in original post

Genius!!! Thank you very much for your answer!!

I'm almost there.

 

How can I put this expressions together ?

 

Filter(VisitorRegister, Office=Office365Users.MyProfile().OfficeLocation)

 

and

 

If(Dropdown2.Selected.Value = "All",Filter(VisitorRegister, Created>=Today()-1),
Dropdown2.Selected.Value = "Open",Filter(VisitorRegister, Created>=Today()-1 && IsBlank(CheckOut)),
Dropdown2.Selected.Value = "Closed",Filter(VisitorRegister, Created>=Today()-1 && !IsBlank(CheckOut))))

 

 

 

 

 

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,488)