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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (59,537)