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.

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.

Top Kudoed Authors
Users online (1,486)