web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple If Statement ...
Power Apps
Unanswered

Multiple If Statement to Filter Gallery

(0) ShareShare
ReportReport
Posted on by 5,331 Moderator

I am using a Collection (from SPList1). SPList1 includes columns for AssociateFullName and ManagerName.

I am in need of a multiple 'If' filter.

There is a manager who needs 'Admin' (view/edit all items) access, whose name is also in the ManagerName column of Collection1 (SPList1).

I am trying to write an 'If' filter that accounts for the above.

I believe the below says: 

- If the logged in user's name is in the Collection1 ManagerName column AND the name 'Joe Schmoe' IS NOT in ManagerNameFld.Text then show all items associated with the ManagerName where that name matches the contents of ManagerNameFld.Text.

- If logged in user Position equals 'Associate' show only THAT associate's items.

-Else show all items

Existing If Statement:
If(User().FullName = ManagerNameFld.Text && !"Joe Schmoe" in ManagerNameFld.Text,
Filter(Collection1, ManagerName = ManagerNameFld.Text),
If(UserPositionFld.Text="Associate",
Filter(Collection1, AssociateFullName = User().FullName),
SortByColumns(Filter(Collection1,
StartsWith(AssociateLastName,
AssociateLastNameSearchFld.Text)),
"AssociateFullName"))

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Phineas 

    I think I got your conditions and results correct and with just 1 If().

     

    With({cond1:User().FullName = ManagerNameFld.Text && !"Joe Schmoe" in ManagerNameFld.Text,
     result1:Filter(Collection1, ManagerName = ManagerNameFld.Text),
     cond2:UserPositionFld.Text="Associate",
     result2:Filter(Collection1, AssociateFullName = User().FullName),AssociateFullName &&
     StartsWith(AssociateLastName,AssociateLastNameSearchFld.Text), 
     },
     If(cond1, result1,
     cond2, Sort(result2,AssociateFullName, Ascending),
     Sort(Collection1,AssociateFullName,Ascending)
    )
     
     
    
    

     

     

  • Phineas Profile Picture
    5,331 Moderator on at

    I can't get it to work.

    The code is error free until I get to the && before the StartsWith.

    Power Apps also doesn't recognize the 'AssociateLastName' reference after the StartsWith in your version, but it does in mine.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard