Dynamics Nav (Navision) webservice ReadMultiple date filter

后端 未结 2 617
盖世英雄少女心
盖世英雄少女心 2020-12-19 23:37

Using the Navision webservices, how can you filter by a date.

i.e. Within a SalesHeader table there is an \"ExportedDate\". I would like to find all SalesHeaders whe

相关标签:
2条回答
  • 2020-12-20 00:18

    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.

    0 讨论(0)
  • 2020-12-20 00:36

    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.
    
    0 讨论(0)
提交回复
热议问题