Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Multiple If Statement to Filter Gallery

(0) ShareShare
ReportReport
Posted on by 4,682 Super User 2025 Season 1

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:
  • Phineas Profile Picture
    4,682 Super User 2025 Season 1 on at
    Re: Multiple If Statement to Filter Gallery

    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.

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at
    Re: Multiple If Statement to Filter Gallery

    @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)
    )
     
     
    
    

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard