从Acumatica Web Service API检索时“排序依据”

时间:2016-01-08 04:46:31

标签: acumatica

我想知道在通过Web服务API从Acumatica检索数据时是否有办法添加“Order By”子句?

ask._tags.pull(tagId)

我想通过DefaultPrice对结果进行排序,以便我可以检索列表中最昂贵的200个项目(在这种情况下使用iMaxRecords = 200)

我还没有看到任何允许我进行排序的参数。

1 个答案:

答案 0 :(得分:0)

当我开发循环分配系统并且简短的答案是使用Acumatica API时,我遇到了这个问题,你不能对你在API之外做的结果做一个排序(这个信息来自一个朋友紧密联系在一起到Acumatica产品)。

我想出了两个选择:

  1. 直接查询您的数据库...总是有理由不这样做,但它比从API中提取结果快得多,并且允许您绕过BQL Acumatica使用并编写一个完全符合您的SQL语句希望提供比Acumatica发送的锯齿状阵列更容易使用的结果。
  2. 您可以使用一些Linq并构建第二个按价格排序的数组[] [],然后将其修剪为前200个(您需要首先获得Acumatica的所有结果)。

    // This is rough but should get you there. 
    string[][] MaxPriceList = sReturn.OrderBy(innerArray =>
        {
            if () // This is a test to make sure the element is not null
            {
                decimal price;
                if (//test decimal is not null))
                    return price;
            }
    
            return price.MaxValue;
        }).Take(200).ToArray(); //Take 200 is a shot but might work