Forum Discussion
Help using SQl to limit the data being pulled form Microsoft Dynamics by Odata
Hi mike_asplin
As you are using odata, it is possible to acheive that
You can find more information under the following link:
https://www.odata.org/getting-started/basic-tutorial/
But to achieve that, you can edit your power query with the following approach:
let
Url = "https://chaxxxxx.api.crm11.dynamics.com/api/data/v9.1/",
SelectColumns = "name,_cha_clientid_value,_owningteam_value,duration,starttime,_cha_carercontactid_value,_msdyn_workorder_value,msdyn_totalcost,endtime,statuscode,msdyn_milestraveled,msdyn_actualarrivaltime",
FilterDateText = DateTime.ToText(Dateparameter, "yyyy-MM-ddTTHH:mm:ssZ"),
FilterQuery = "$filter=starttime ge " & FilterDateText,
ODataQueryOptions = [
Query = "$select=" & SelectColumns & "&$" & FilterQuery
],
Source = OData.Feed(Url, null, [Implementation="2.0"]),
bookableresourcebookings_table = Source{[Name="bookableresourcebookings", Signature="table"]}[Data],
Data = OData.Feed(bookableresourcebookings_table, null, ODataQueryOptions)
in
Data
Just to be sure to call the date Parameter to Dateparameter and replace the url by the right url and it should work
Thats great and should I expect a big increase in speed?
- Cookistador11 months agoSuper User
Yes, I encountered a similar issue with a customer. It used to take a few minutes for the change to take effect, but now it only takes a few seconds.
The idea is to filter your data before importing it.
If you do not see an improvement, please post again and we will see how we can improve it.
- mike_asplin11 months agoHelper V
I took out the extra T and the ge bit as didnt look right 🙂
Getting an error on this step?