Dynamics Nav (Navision) web 服务 ReadMultiple 日期过滤器

发布于 2024-09-13 12:07:21 字数 175 浏览 5 评论 0原文

使用 Navision Web 服务,如何按日期进行过滤。

即 SalesHeader 表中有一个“ExportedDate”。我想找到未设置 ExportedDate 或在特定日期导出的所有 SalesHeader。

似乎每当我们在日期字段上设置过滤器时,Web 服务要么返回所有行,要么不返回任何行。

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 where the ExportedDate has not been set or were exported on a particular date.

It seems that whenever we set a filter on a date field, then the webservice will either return all rows or no rows.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

相思故 2024-09-20 12:07:21

这是可以做到的。您必须使用与在 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.

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.
玉环 2024-09-20 12:07:21

将第 42 页(销售订单)发布为 NAV 中的 Web 服务后,我在 Visual Studio 项目中添加了对新创建的 Web 服务的 Web 引用。在 C# 代码中,我创建了一个新的服务实例,并告诉它使用默认凭据:

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

然后我实例化一个过滤器,并设置字段和条件: 然后

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

,在传递之前,将过滤器实例添加到新的 SalesOrders_Filters 数组中后者返回 ReadMultiple:

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

在我的机器上,这会返回两个文档日期为 2014 年 1 月 31 日的订单,以及一个文档日期为空白的订单。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文