Hello all I have been searching and I am stumped.
++Edit++ added some posts with more context. Basically I need a button visible if their email is in the SP List and a specific value is in a multi select field of their SPList entry.
I have a Power App with buttons that are visible if the logged in user exists in a SP list using the following works where DataSource is my SP List with a column of Email
Visible = If(User().Email in 'DataSource'.Email, true)
That same SP List has a Department Column which is a multiple choice and I would like to show buttons only to users that need them.
For instance a button called "Update Tax" should only be visible to a user whose email is in the SP List Email column and Tax is one of the selected values in the Department column
Solved! Go to Solution.
I was able to solve this with the following
If(
CountIf('SPList', User().Email in Email && "Tax" in Department.Value),
true,
false
)
Not sure if that is the best way but it seems to work.
Visible property of first button described above: !IsBlank(Lookup(spList, Email=User().Email))
Visible Property of "Update Tax" button:
!IsBlank(LookUp(spList, Email=User().Email)) &&
!IsBlank(LookUp(splist, "Tax" in Department.Value))
If(... not needed since the statement above reduces to true or false
That worked thank you! I do get a warning of "Delegation Warning. The highlighted part of this formula might not work correctly on large data sets." I assume with the SP List only having 20 or less entries I should be ok?
You will always get a delegation warning when the "in" operator is used in SharePoint. As long as your list is <500 items you can ignore it.
Sorry to bother again, this kind of works. What is going on is if Anyone on the list has Tax assigned it is visible for everyone. It needs to be if their email is on the list and tax is there for their name
Please post the visible property of the 2nd button. If you used my formula it shouldn't be possible as both conditions need to be satisfied for the button to be visible. Test the second condition by putting a datatable on a screen with
Filter(splist, "Tax" in Department.Value) in its items property and see what you get.
!IsBlank(LookUp('SPLIST', Email=User().Email)) &&
!IsBlank(LookUp('SPLIST', "Tax" in Department.Value))
The problem if the SPLIST has me and you in it but only I have Tax as a value in the Department Column then the button will be visible for both of us if I understand it right the visible property is just looking to see if "Tax" is present not necessarily for the combination of email and Tax
There are 6 buttons with corresponding departments in the multi-choice column of the SPList the desired effect would be you have 3 options selected in your department column then you get those 3 buttons while I will get only the buttons I have selected there. Right now the Visible command is the same for all 6 only with "Tax" changed to the correct option. This works fine for a single user however as soon as a second user is added both users get buttons for all users. I hope I am explaining it correctly
here is my SP List User 1 should only have the Access Button, User 2 should have Access and Org, while User 3 should have them all. Currently all users have all buttons because all the department exists on user 3
I was able to solve this with the following
If(
CountIf('SPList', User().Email in Email && "Tax" in Department.Value),
true,
false
)
Not sure if that is the best way but it seems to work.
User | Count |
---|---|
252 | |
113 | |
92 | |
48 | |
38 |