【问题标题】:Can i get Next topCount with web services Acumatica?我可以通过 Web 服务 Acumatica 获得 Next topCount 吗?
【发布时间】:2017-05-25 04:54:04
【问题描述】:

我想通过顶部数据获得顶部,“首先是 100,然后是 101 到 200”,是否存在某种方式可以通过 Acumatica 上的 web 服务获取这样的结果?因为我只看到 API“topCount”参数,而且我只可以获取静态数据数。

请帮助我不知道这是否适用于网络服务

【问题讨论】:

    标签: c# php api acumatica


    【解决方案1】:

    Acumatica 始终通过按关键字段升序排序的 API 导出记录。为了批量导出记录,您应该简单地将$top 参数与附加的GreaterThen 条件结合起来以获取最后检索的关键字段:

    http://localhost/051989/entity/Default/6.00.001/StockItem?$top=10&$filter=InventoryID gt 'CONGOLFR1'
    

    结合$top$skip 参数,Acumatica 总是首先请求$top 参数指定的记录数,然后从结果集的开头排除$skip 参数指定的记录数:

    http://localhost/051989/entity/Default/6.00.001/StockItem?$top=10$skip=5
    

    跳过参数不适用于 SOAP。要使用 SOAP 批量导出记录,您应该将 RowNumber 属性的 LessThan 条件与最后检索的关键字段的 GreaterThen 条件结合起来:

    using (DefaultSoapClient client = new DefaultSoapClient())
    {
        client.Login("login", "password", null, null, null);
        try
        {
            var items = client.GetList(
            new StockItem
            {
                RowNumber = new LongSearch
                {
                    Condition = LongCondition.IsLessThan,
                    Value = 10
                }
            },
            false);
    
            int count = items.Length;
            Console.WriteLine("InventoryID | Description | ItemClass | BaseUOM | LastModified");
            foreach (StockItem stockItem in items)
            {
                Console.WriteLine(
                    string.Format("{0} | {1} | {2} | {3} | {4}",
                        stockItem.InventoryID.Value,
                        stockItem.Description.Value,
                        stockItem.ItemClass.Value,
                        stockItem.BaseUOM.Value,
                        stockItem.LastModified.Value));
            }
    
            while (items.Length == 10)
            {
                StockItem filter = new StockItem
                {
                    RowNumber = new LongSearch
                    {
                        Condition = LongCondition.IsLessThan,
                        Value = 10
                    },
                    InventoryID = new StringSearch
                    {
                        Condition = StringCondition.IsGreaterThan,
                        Value = (items[items.Length - 1] as StockItem).InventoryID.Value
                    }
                };
    
                items = client.GetList(filter, false);
                count = count + items.Length;
                foreach (StockItem stockItem in items)
                {
                    Console.WriteLine(
                        string.Format("{0} | {1} | {2} | {3} | {4}",
                            stockItem.InventoryID.Value,
                            stockItem.Description.Value,
                            stockItem.ItemClass.Value,
                            stockItem.BaseUOM.Value,
                            stockItem.LastModified.Value));
                }
            }
    
            Console.WriteLine();
            Console.WriteLine(string.Format("Stock Items exported: {0}", count));
            Console.WriteLine();
        }
        finally
        {
            client.Logout();
        }
    }
    

    【讨论】:

    • 是否可以将 $skip 与 SOAP 一起使用?谢谢
    • 跳过参数不适用于 SOAP。有关详细信息,请参阅上面的更新答案。
    • 感谢RowNumber 的提示!我一直在寻找。
    猜你喜欢
    • 2015-08-09
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2016-06-19
    • 2019-11-30
    • 2015-07-30
    • 1970-01-01
    相关资源
    最近更新 更多