cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielRK
Super User
Super User

Filter gallery for manager and office users not working

Hi,

 

I want to filter my gallery with multiple controls but also depending on whether a user is a manager or office user:

 

So if an office user, the records are filtered by the office column for that user's office (this is fixed for security and cannot be undone so users can't see other offices records) but within that filter criteria they must be able to use a search box and other dropdown filters to filter their records.

 

If a manager the gallery is filtered by that manager's region (this fixed for security as other managers must not see other regions records) but within that filter criteria they must be able to use a search box and other dropdown filters to filter their records.

 

There is a variable to identify the user as a manager or not (ie office user): 'IsREUser'

 

This is my attempt at this (in the 'items' property of the gallery):

 

 

 

SortByColumns(
    Filter(
        DataSource,
        StartsWith(
            Office,
            TextSearch.Text
        ) && (Vacancy = CBJobTitle.Selected.Title || CBJobTitle.Selected.Title = Blank()) && (Status.Value = CBStatus.Selected.Value || CBStatus.Selected.Value = Blank()) && (IsUserRE && (Region = varRERegion)) || (!IsUserRE && (Office = varUserOffice))
    ),
    "ID",
    Ascending
)

 

 

 

 

It works fine if the 'IsUserRE' (meaning the logged in user is a manager) is true but when this value is false the 'search' and 'dropdown' controls don't work when values are entered in or selected.

 

What am I doing wrong?

 

DanielRK_0-1623964546767.png

 

Thank you again!

 

Regards,

 

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions
DanielRK
Super User
Super User

Hi,

 

I think I figured out what I did wrong. The last section of the formula needed to be encased in brackets like this:

 

((IsUserRE && (Region = varRERegion)) || (!IsUserRE && (Office = varUserOffice)))
    ),

 

It seems to be working now.

 

Regards,

 

Daniel

View solution in original post

2 REPLIES 2
DanielRK
Super User
Super User

Hi,

 

I think I figured out what I did wrong. The last section of the formula needed to be encased in brackets like this:

 

((IsUserRE && (Region = varRERegion)) || (!IsUserRE && (Office = varUserOffice)))
    ),

 

It seems to be working now.

 

Regards,

 

Daniel

Mari
Community Support
Community Support

Thanks for updating this thread!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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