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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,166)