cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Super User
Super User

Re: Filtering a gallery by user's location

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
Super User
Super User

Re: Filtering a gallery by user's location

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

Highlighted
Frequent Visitor

Re: Filtering a gallery by user's location

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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (3,676)