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 / Help with Filtering a ...
Power Apps
Answered

Help with Filtering a Gallery and Variable

(0) ShareShare
ReportReport
Posted on by

Good day

 

I have a gallery with the following Items (linked to a SQL database):

Filter(SubmissionRatingsAdmin, CorpSecDateInt = Year(DatePicker1.SelectedDate)*10000 + Month(DatePicker1.SelectedDate)*100 + Day(DatePicker1.SelectedDate) And CorpSecCommittee in Dropdown2.SelectedText.Committee)

Unfortunately it gives me a Delegation error.  Please assist me to declare a variable to get rid of the error? 

 

Thank you 

Janine

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @janineb ,

    Other than the in Filter (which I think is Delegable in SQL), you can do this

    With(
     {
     wInt:
     Year(DatePicker1.SelectedDate)*10000 + 
     Month(DatePicker1.SelectedDate)*100 + 
     Day(DatePicker1.SelectedDate)
     },
     Filter(
     SubmissionRatingsAdmin,
     CorpSecDateInt = wInt &&
     CorpSecCommittee in Dropdown2.Selected.Committee
     )
    )

     

    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

  • janineb Profile Picture
    on at

    Hi Warren

    I still have the delegation warning on the gallery.  Any other suggestions perhaps?  Thank you

     

  • janineb Profile Picture
    on at

    It is also not returning any items, although there are items in the database?

     

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

    Hi @janineb ,

    I simply copied your values and shifted the variable you were creating in the body of the filter outside it (and away from Delegation scrutiny), so it has not changed your filter functionality. If the in Filter is not Delegable in SQL, then you cannot make this Delegable, however this guide (which is normally accurate) says it is.

  • Verified answer
    janineb Profile Picture
    on at

    Thank you - there is nothing wrong with your code - it is perfect 🙂  as always.  I just don't understand why the filter is not returning any items (it was not working before either). 

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

    @janineb ,

    So you are saying it was not working before ? Put this in a label

    Year(DatePicker1.SelectedDate)*10000 + 
    Month(DatePicker1.SelectedDate)*100 + 
    Day(DatePicker1.SelectedDate)

    and ensure you have the same value in field CorpSecDateInt in SubmissionRatingsAdmin in at least one record and this record also contains a value in CorpSecCommittee you have selected in your drop-down.

     

    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



     

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard