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
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,924)