On the face it seems simple but, Iโm struggling to find the expression that is both valid and acceptable as a security filter. (Virtual Columns are not an option with security fields)
To summarize; Two separate tables, People and Apps. Each table has a single field [Crew]
In the People table, a person can belong to more than one crew. This is saved in field People[Crew]. If this field contains multiple crews, (person belongs to multiple crews) each value is separated with a coma and a space: Crew1, Crew2.
In the Apps table, the [Crew] field determines which crew(s) can access the app specified but the row. Each app can be accessed by several multiple crews:
App โAโ can be accessed by Crew1, Crew2
App โBโ can be accessed by Crew1, Crew3 (but not crew 2)
The following expression works fine so long as the person only belongs to ONE crew. If additional crews are added to People[Crew], the expression returns no rows from the Apps table.
From the Apps table I set the following as the security filter:
CONTAINS([Crew], SELECT(People[Crew], [UserEmail]=USEREMAIL()))
I have tried many different combinations of IF(), INTERSECT(), CONTAINS(), etc and all fail for one reason or another. The expression is either outright invalid, valid or cannot be used as a security filter (VCs), or is valid but doesnโt return any values.
Iโd appreciate anyone that could get me pointed in the right directionโฆ
Maybe something like this?
Assuming Apps[Crew] is also a a text field separated by a comma and a space.
ISNOTBLANK(
INTERSECT(
SPLIT( [Crew] , ", ")
,
SPLIT( LOOKUP( USEREMAIL() , "People" , "UserEmail" , "Crew") , ", ")
)
)
IN() is a better option than CONTAINS()
This might help:
Because this setup relies on the use of a slice, wouldnโt itโs use be ruled out of security filters? All data would be sent to and from the userโs app instance, correct?
The setup I currently have is very similar with the exception of creating the sliceโฆ
Try:
ISNOTBLANK(
FILTER(
"People",
IFS(
ISBLANK([UserEmail]),
FALSE,
NOT([UserEmail] = USEREMAIL()),
FALSE,
ISBLANK(
INTERSECT(
[_THISROW].[Crew],
[Crew]
)
),
FALSE,
TRUE,
TRUE
)
)
)
This is expensive. @MultiTech_Visionsโ Current_User slice would help a lot.
User | Count |
---|---|
15 | |
14 | |
8 | |
7 | |
4 |