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"))
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.
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)
)
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional