cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dpalmer
Helper III
Helper III

Search on SQL datetime field

Hi,

I'm trying to add a searchbox for a gallery that I can search on a SQL datetime field.  I'm getting a delegation warning.  Search is delagable for SQL and from what I can research, the datetime column type should work as well.  My gallery Items property is:

 

Sort(Search(Filter('[dbo].[ShiftDuty]', Last_Name = PName), SearchBox1.Text, "Date"), Date, Descending)

 

Trying to search on the "Date" field in the ShiftDuty table.  Is it the order of operations for the Sort/Search/Filter functions?


Thanks,
David

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Dpalmer ,

Please notice that:

Operation/Function Number Text Boolean DateTime Guid
Filter Yes Yes Yes No [1] Yes
Sort Yes Yes Yes Yes -
SortByColumns Yes Yes Yes Yes -
Search No Yes No No -
Lookup Yes Yes Yes Yes Yes

DateTime type is non-delegateable in search function.

That's the reason why you met delegation problem.

In all the functions that are used to search, datetime type is delegateable only in lookup function.

So to not have delegation warning, you could use lookup function instead of search function, or change the Date datetime type to text.

You could also consider save data in collection. Collection will not have delegation problem.

What's more, if your record number is smaller than 2000, you do not need to worry about delegation problem.This  will not effect the app's performance.

You just need to change the delegateable limit to 2000.

delegation.jpg

 

Here's a doc about delegateable functions in sql server for your reference:
https://docs.microsoft.com/en-us/connectors/sql/

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yutliu-msft
Community Support
Community Support

Hi @Dpalmer ,

Please notice that:

Operation/Function Number Text Boolean DateTime Guid
Filter Yes Yes Yes No [1] Yes
Sort Yes Yes Yes Yes -
SortByColumns Yes Yes Yes Yes -
Search No Yes No No -
Lookup Yes Yes Yes Yes Yes

DateTime type is non-delegateable in search function.

That's the reason why you met delegation problem.

In all the functions that are used to search, datetime type is delegateable only in lookup function.

So to not have delegation warning, you could use lookup function instead of search function, or change the Date datetime type to text.

You could also consider save data in collection. Collection will not have delegation problem.

What's more, if your record number is smaller than 2000, you do not need to worry about delegation problem.This  will not effect the app's performance.

You just need to change the delegateable limit to 2000.

delegation.jpg

 

Here's a doc about delegateable functions in sql server for your reference:
https://docs.microsoft.com/en-us/connectors/sql/

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,387)