cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
denise_martinca
Helper II
Helper II

Filter gallery depending on the app user

Hi, everyone! I have made an app that should assign employees' requests to different members of the company depending on the manager. I've got 2 lists: 1)It is called "Retornoflexible_1", it contains all the requests and one of the columns is "Legajo" which is the requester's ID, text type. 2)It is called "TablaEmpleados", it contains all the employees' ids (USERID), their email (EMAIL) and manager's id (MANAGER). I would like to filter a gallery with all the requests depending on who is logged in. I would need to look up the requester's id on Retornoflexible_1, obtain the manager´s id, then look up the manager´s id and get it's email. After that, I may filter the gallery. I used this code in the items property of the gallery but it keeps failing.

Filter(RetornoFlexible_1;LookUp(TablaEmpleados;LookUp(TablaEmpleados;Legajo=USERID;'MANAGER')=USERID;'EMAIL')=User().Email)

I think that I have the problem with "Legajo" reference but I'm not sure what I am doing wrong.

Captura.JPG

Thank you in advanced!!!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @denise_martinca ,

Could you please share a bit more about your scenario?

Do you want to list all available requests which are assigned to current sign in user inside your Gallery?

Further, does the "Legajo" column in "Retornoflexible_1"List match the USERID column in your "TablaEmpleados" List?

 

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

Filter(
       RetornoFlexible_1;
       LookUp(
              TablaEmpleados;
              USERID = LookUp(TablaEmpleados; USERID = Legajo).MANAGER
       ).EMAIL = User().Email
)

Note: I assume that each "Legajo" column from "Retornoflexible_1"List could only match single one record in your "TablaEmpleados" List. The USERID column is a unique type column (without duplicates) in your "TablaEmpleados" List. And the USERID column and the MANAGER column store similar value.

 

Of course, I think the Addcolumns function could also achieve your needs. Please consider try the following workaround:

Filter(
       AddColumns(
               AddColumns(
                        RetornoFlexible_1;
                        "ManagerID"; LookUp(TablaEmpleados; USERID = Legajo; MANAGER)
               );
               "ManagerEmail"; LookUp(TablaEmpleados; USERID = ManagerID; EMAIL)
       );
       ManagerEmail = User().Email
)

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @denise_martinca ,

Could you please share a bit more about your scenario?

Do you want to list all available requests which are assigned to current sign in user inside your Gallery?

Further, does the "Legajo" column in "Retornoflexible_1"List match the USERID column in your "TablaEmpleados" List?

 

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the Gallery to following:

Filter(
       RetornoFlexible_1;
       LookUp(
              TablaEmpleados;
              USERID = LookUp(TablaEmpleados; USERID = Legajo).MANAGER
       ).EMAIL = User().Email
)

Note: I assume that each "Legajo" column from "Retornoflexible_1"List could only match single one record in your "TablaEmpleados" List. The USERID column is a unique type column (without duplicates) in your "TablaEmpleados" List. And the USERID column and the MANAGER column store similar value.

 

Of course, I think the Addcolumns function could also achieve your needs. Please consider try the following workaround:

Filter(
       AddColumns(
               AddColumns(
                        RetornoFlexible_1;
                        "ManagerID"; LookUp(TablaEmpleados; USERID = Legajo; MANAGER)
               );
               "ManagerEmail"; LookUp(TablaEmpleados; USERID = ManagerID; EMAIL)
       );
       ManagerEmail = User().Email
)

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you very much!! I used this code and it worked perfectly!!!!!!!

Filter(
       AddColumns(
               AddColumns(
                        RetornoFlexible_1;
                        "ManagerID"; LookUp(TablaEmpleados; USERID = Legajo; MANAGER)
               );
               "ManagerEmail"; LookUp(TablaEmpleados; USERID = ManagerID; EMAIL)
       );
       ManagerEmail = User().Email
)

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (1,993)