Hi @Ajh ,
The reason why you still have delegation warning is because of comparing with datetime field.
Please notice that:
Direct date filters do not work for SQL Server. However, you can create a calculated column that will work. For instance, ALTER TABLE myTable ADD DateAsInt AS (YEAR([date]) * 10000 + MONTH([date]) * 100 + DAY([date])) and then filter on the calculated number column.
So you could try this:
Filter(
SortByColumns(
Search([@'[UDM].[StormData]']
, TextSearchBox1.Text, "Class","Remarks","Designation","ParentType","ParentID")
, "StormDate", If(SortDescending1, Ascending, Descending)
)
,RecordVersion=0 &&
(Year(DatePicker1.SelectedDate) * 10000 + Month(DatePicker1.SelectedDate) * 100 + Day(DatePicker1.SelectedDate) =
Year(StormDate ) * 10000 + Month(StormDate) * 100 +Day(StormDate)
||
(Year(DatePicker1.SelectedDate) * 10000 + Month(DatePicker1.SelectedDate) * 100 + Day(DatePicker1.SelectedDate) =
Year(StartDate ) * 10000 + Month(StartDate) * 100 +Day(StartDate)
||
IsBlank(DatePicker1.SelectedDate)
)
)
However, Year(),Month() and Day() function is not delegate for sql server.
So comparing with datetime field is a key problem for sql server.
If the formula above does not work for you, I suggest you save data to collection to avoid delegation problem.
In collection, you do not have to only use delegate functions.
The steps:
set the app's OnStart:
ClearCollect(
test,[@'[UDM].[StormData]'
)
The filter function(filter collection):
Filter(
SortByColumns(
Search(test
, TextSearchBox1.Text, "Class","Remarks","Designation","ParentType","ParentID")
, "StormDate", If(SortDescending1, Ascending, Descending)
)
,RecordVersion=0 && (DatePicker1.SelectedDate = StormDate || DatePicker1.SelectedDate = StartDate || IsBlank(DatePicker1.SelectedDate) )
)
I suggest you know more about limitations of sql server in powerapps:
https://docs.microsoft.com/en-us/connectors/sql/
Best regards,