web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery filter not wor...
Power Apps
Answered

Gallery filter not working in Published version

(0) ShareShare
ReportReport
Posted on by 215

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

 

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,678 Moderator on at

    @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 Profile Picture
    153,452 Most Valuable Professional on at

    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 Profile Picture
    215 on at

    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?

  • WarrenBelz Profile Picture
    153,452 Most Valuable Professional on at

    @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 Profile Picture
    153,452 Most Valuable Professional on at

    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 Profile Picture
    215 on at

    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.

    With old code.PNG
    With new code.PNG
  • WarrenBelz Profile Picture
    153,452 Most Valuable Professional on at

    @PowerUser19 ,

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

  • PowerUser19 Profile Picture
    215 on at

    Hi @WarrenBelz ,

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

  • WarrenBelz Profile Picture
    153,452 Most Valuable Professional on at

    Hi @PowerUser19 ,

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

  • PowerUser19 Profile Picture
    215 on at

    Hi @WarrenBelz ,

     

    It is either "Approved" or Blank. No other statuses. My condition for the filter is Not equal to Approved and If visit required for that department is True. Please find the screenshot of the database.

    Sharepointlist.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 361

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard