
Hello everybody and a happy new year!
I'm absolutely struggling, but maybe I'm just missing something.
I've got two Sharepoint lists. The first one (A) contains entries of Human Resources including three fields for Sharepoint Managed Metadata which represent the three hierarchic organization levels of my company (MM_1, MM_2, MM_3) and a fourth field (MM) that specifies which coworker is running those departments for everyone.
E.g.: Coworker1 has three metadata columns for department 1st, 2nd and 3rd level, each one single value, that specify which departments he belongs to. 4th field (MM) is blank.
Superior1 also has those columns (naturally) but department 1st level field is empty as he runs it (so MM field - multi value as there are coworkers who run several departments - contains the department 1st level he runs. Department 2nd and 3rd level field have values.
Superior2's fields MM_1 and MM_2 are empty, as he runs a department 2nd level which is given in MM.
The second one (B) includes vacation requests of coworkers. It's shown as a gallery in powerapps.
What I want to do is the following:
1) I want to identify the currently logged in user and lookup in List A if he's got the permissions to see those vacation requests - i.e. that his MM field is not blank - and which ones, i.e. those from the department he's running.
2) I want to compare the coworker names in List A to the (identical) names in List B by each other to find out which departments of the 3 different levels the coworker belongs to.
3) I want to filter those vacation requests based on the levels of the currently logged in user - so coworker1 is only allowed to see the requests from department 1st level he runs, but coworker2 can see all those from department 2nd level.
Anybody got an idea how to build the filter function here? Help is much appreciated.
Thanks
zaphod88
Hi @zaphod88 ,
1)Try this formula:
Filer(listB, coworker_email in
Filter(listA,
!IsBlank(MM),
MM=LookUp(Superior1,coworker_email=User().Email,MM)
).coworker_email
)
2)Could you tell me what columns in listB that can represent department?
how do you want to compare in details?
3)Is coworker1 and coworker2 two specific user?
If so , please try this:
If(User().Email="coworker1 email",
Filer(listB, coworker_email in
Filter(listA,
!IsBlank(MM),
MM=LookUp(Superior1,coworker_email=User().Email,MM)
).coworker_email
),
User().Email="coworker2 email",
Filer(listB, coworker_email in
Filter(listA,
MM_2=LookUp(Superior1,coworker_email=User().Email,MM_2)
).coworker_email
)
)
Best regards,