Hi all,
if just want to filter my gallery on a date field. Something like:
SortByColumns( Filter('[dbo].[tTime]'; Date=Text(_dateSelected; "[$-de-DE]yyyy-mm-dd") & " 00:00:00.000") ; "Date")
But it doesn't work.
I'm using the CalendarScreen for my example:
Here's a screenshot of my database table (field "date"):
Can you help me please?
thanks
jup
Solved! Go to Solution.
From the documentation on SQL delegation limitations
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.
To filter on the date with delegation you'll need to add a calculated column to your SQL Table.
The other possibility that might also work would be to do your Filter statement at two levels like this:
Filter(Filter('[dbo].[tZeit]';PersonalNr=1513),Text(Datum;"[$-de-DE]yyy-mm-dd")="2017-01-71")
This will work even though the Date filter isn't delegable IF the filter on PersonalNr can get the record set below 500 records returned. So this strategy depends on your data.
Put a Text() formatting function around the Date field also so both sides of the equation are considered text.
No. Sorry. Doesn't work:
Filter('[dbo].[tZeit]'; Text(Datum)="2017-05-01 00:00:00.000")
Doesn' t work,too:
Filter('[dbo].[tZeit]'; Text(Datum;"[$-de-DE]")="2017-05-01 00:00:00.000")
any idea?
I got (a little bit)...
but other question:
If I use this formula - it works great:
I get the results of my formula 🙂
BUT if I want to use a 2nd filter condition, the formula will be underlined blue and I'll get no results (because of "Delegation limit"):
How can I solve this problem?
Thanks,
jup
Hi @jup
SortByColumns( Filter('[dbo].[tTime]'; DateValue(Text(Date))=DateValue(Text(_dateSelected; "[$-de-DE]yyyy-mm-dd"))) ; "Date")
From the documentation on SQL delegation limitations
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.
To filter on the date with delegation you'll need to add a calculated column to your SQL Table.
The other possibility that might also work would be to do your Filter statement at two levels like this:
Filter(Filter('[dbo].[tZeit]';PersonalNr=1513),Text(Datum;"[$-de-DE]yyy-mm-dd")="2017-01-71")
This will work even though the Date filter isn't delegable IF the filter on PersonalNr can get the record set below 500 records returned. So this strategy depends on your data.
User | Count |
---|---|
157 | |
93 | |
80 | |
74 | |
57 |
User | Count |
---|---|
202 | |
166 | |
98 | |
94 | |
79 |