Dynamics Nav (Navision) webservice ReadMultiple date filter

与世无争的帅哥 提交于 2019-11-29 12:12:37
jaensen

This can be done. You have to use the same filter expression as you would use in the Nav Client:

01012011..         would be all dates from 01.01.2011
..01012011         would be all dates to 01.01.2011
01012011..03012011 gets all dates between 01. and 03.

After publishing page 42 (Sales Order) as a web service in NAV, I added a web reference to the newly created web service in my Visual Studio project. In the C# code, I create a new instance of the service, and tell it to use the default credentials:

SalesOrders_Service salesOrdersService = new SalesOrders_Service();
salesOrdersService.UseDefaultCredentials = true;

Then I instantiate a filter, and set the field and criteria:

SalesOrders_Filter filter = new SalesOrders_Filter();
filter.Field = SalesOrders_Fields.Document_Date;
filter.Criteria = "01-31-14|''"; // specific date (MM-dd-yy) or empty

The filter instance is then added to a new array of SalesOrders_Filters before passing the latter to ReadMultiple:

SalesOrders[] salesOrders = salesOrdersService.ReadMultiple(new SalesOrders_Filter[] { filter }, null, 0);

On my machine, this returns two orders whose Document Date is 31 January 2014, and one order with a blank Document Date.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!