How would i find all records in SQL server whos date is 60 or more days old.
Filter("MY TABLE", DateDiff(Now(), IN_SYSTEM_DATE) >= 60)
But i keep getting service limitation error. I thought Filter supported delegation with SQL server... How would i acheive this?
I have a solution for you. Since 60 days ago is a static date, you can have it pre-calculated so that your filter does not need it calculated for each row.
Create a DatePicker control to store the static calculation. Set its DefaultDate property to:
This means, "Add negative 60 days to the date and time now." You could use Today() in place of Now().
You can hide the DatePicker control if you don't want it seen. Set its Visible property to false. At this point, you could also get creative by adding a slider to adjust 60 days to whatever other amount you want. In that case, you would adjust DatePicker.DefaultDate to:
Then Filter your table comparing dates against the DatePicker you just created:
This means, "Filter my table to show all dates that are older than or equal to 60 days ago, the date calculated in DatePicker.
Note: Delegation is supported with Controls this way; a context variable would not work for this.
Let me know how this works for you.
My guess is that there is a mismatch between data types. The dates in your datasource may be formatted differently than the DatePicker, but I really don't know.
This is probably a question for the PA team.
There SQL Server / Azure SQL DB connector currently has many bugs, including the following:
1) After a field contains a value, you cannot set the value back to null from PowerApps
2) There are intermittent issues writing numbers with more than 7 significant figures to the database
3) Date type columns cannot be filtered using > or < operators
4) Writing to date type columns is problematic
As a work-around for 3) and 4) I now store all date information as an integer of value yyyymmdd. This allows me to filter using > and < operators as well as avoid all pitfalls with time zones.
I know that the PowerApps team is working to resolve all the above, and there should be a new connector out in July sometime.
Hope this helps.
PS I have many posts on all the above and more if you want to search the community
Unfortunately communication from the PowerApps group is generally pretty poor and unstructured. We have complained about it, but no real progress. They have now put status on the ideas section but no dates and no details.
I know about the significant figures issue since I wrote to the support team and received a reply to say that they are working on a fix and should be out in July.
Putting two and two together, I just imagine that they are reviewing the whole SQL connector as it is just too buggy at the moment.
Sorry to disappoint.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!