cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
janineb
Helper I
Helper I

Help with Filtering a Gallery and Variable

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

1 ACCEPTED SOLUTION

Accepted Solutions
janineb
Helper I
Helper I

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). 

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

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
Helper I
Helper I

Hi Warren

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

 

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

 

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.

janineb
Helper I
Helper I

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). 

@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



 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,718)