cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerUser19
Helper III
Helper III

Gallery filter not working in Published version

Hi,

I am a beginner. I am developing an application for visitor request and approval process. I am using the code below for the Gallery filter. It works fine in the dev but not in the published version.

 

If(User().Email="XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX", Filter(VisitorRequestList,PD_Visit_Required="true" And PD_Manager_Approval<>"Approved"), If(User().Email= "XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX", Filter(VisitorRequestList,'C&A_Visit_Required'="true" And 'C&A_Manager_Approval'<>"Approved"),If(User().Email="XXX" Or "XXX" Or "XXX" Or "XXX" Or "XXX" , Filter(VisitorRequestList,VE_Visit_Required="true" And VE_Manager_Approval<>"Approved"))))

 

The code may not be efficient. The scenario is there are 3 different departments. When a visitor submits a request, the request should be visible for the approvers of the respective department. The reason I have different email check is because, when a request is submitted to a department, any one of the managers should be able to approve the request. There is no approval flow. If there are 4 managers any one of the 4 in that department can approve the request submitted to that department. 

 

I can see the gallery filtering the correct data in the dev but the published version shows there are no records to approve. Your help with this is highly appreciated.

 

Thanks in advance! 

 

Priya

 

1 ACCEPTED SOLUTION

Accepted Solutions

@PowerUser19 ,

OK - I can uncomplicate this a bit as I spilt it before due to <> not being Delegable

With(
   {
      wMatch1: User().Email in ["XXX", "XXX", "XXX", "XXX", "XXX", "XXX"],
      wMatch2: User().Email in ["YYY", "YYY", "YYY", "YYY", "YYY"],
      wMatch3: User().Email in ["ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ"]
   },
   Filter(
      VisitorRequestList,
      (wMatch1 && PD_Visit_Required = "true" && PD_Manager_Approval = Blank()) && 
      (wMatch2 && C&A_Visit_Required' = "true && C&A_Manager_Approval' = Blank()) &&
      (wMatch3 && VE_Visit_Required = "true" && VE_Manager_Approval = Blank())
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

12 REPLIES 12
AhmedSalih
Super User
Super User

@PowerUser19, are you sure that the Email Account that is Playing the APP once it is published meets the IF statement criteria?

One way to check is to add a label on your first screen and have the lable's Text value as User().Email

 

 

WarrenBelz
Super User
Super User

Hi @PowerUser19 ,

Your email structure will not return all the matches like that - you can put User().Email in front of each one or do this

With(
   {
      wMatch1: User().Email in ["XXX", "XXX", "XXX", "XXX", "XXX", "XXX"],
	  wMatch2: User().Email in ["YYY", "YYY", "YYY", "YYY", "YYY"],
	  wMatch3: User().Email in ["ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ"]
   },
   Filter(
      VisitorRequestList,
      (
         wMatch1 && PD_Visit_Required = "true" && PD_Manager_Approval <> "Approved"
      ) && 
      (
         wMatch2 && C&A_Visit_Required' = "true" && 'C&A_Manager_Approval' <> "Approved"
      ) &&
      (
         wMatch3 && VE_Visit_Required="true" && VE_Manager_Approval <> "Approved")
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

PowerUser19
Helper III
Helper III

Hi @WarrenBelz ,

 

Thank you so much. I will try this code. Yes, I did get a delegation warning with my original code as well. Is there any way to resolve it? Or is there any other better way to do this filter (using the same conditions) to avoid the delegation warning?

@PowerUser19 ,

A bit clunky, but this should do it. Note however that the output of the second With() statement is limited to records numbers of your Delegation limit

With(
   {
      wMatch1: User().Email in ["XXX", "XXX", "XXX", "XXX", "XXX", "XXX"],
	  wMatch2: User().Email in ["YYY", "YYY", "YYY", "YYY", "YYY"],
	  wMatch3: User().Email in ["ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ", "ZZZ"]
   },
   With(
      {
         wList:
         Filter(
            VisitorRequestList,
            (wMatch1 && PD_Visit_Required = "true") && 
            (wMatch2 && C&A_Visit_Required' = "true) &&
            (wMatch3 && VE_Visit_Required = "true")
         )
      },
      Filter(
         wList:
         (wMatch1 && PD_Manager_Approval <> "Approved") && 
         (wMatch2 && 'C&A_Manager_Approval' <> "Approved") &&
         (wMatch3 && VE_Manager_Approval <> "Approved")
      )
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @PowerUser19 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

PowerUser19
Helper III
Helper III

Hi @WarrenBelz ,

My sincere apologies for late response. Was unwell last couple days and didn't get a chance to try this. I tried the code now which removed the warning but not showing any record in the gallery. May be some minor fix is required. With my old code, I see the records with warning though. Your help is much appreciated.  Attaching the screenshots.

@PowerUser19 ,

Try Or || instead of And && on the bottom two sections

Hi @WarrenBelz ,

Now I am able to see all records. Approved records are showing in the Gallery as well. 

Hi @PowerUser19 ,

Thats what I thought - I just wanted to check the values were returning something. What other status value exist other than Approved?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,529)