2017-01-10 3 views
0

私はAPIの "topCount"パラメータだけを見るので、トップデータ、 "最初の100と101から200の後"を取得したいのですが、Acumaticaのwebserviceでこのようになっています。データの静的な数を取得します。WebサービスAcumaticaで次のtopCountを取得できますか?

私は、これは常にキーフィールドによって昇順にソートされたAPIを経由してレコードをエクスポートするWebサービス

答えて

2

Acumaticaとかのうであれば知らない助けてください。バッチでレコードをエクスポートするためには、あなたは、単に最後に取得したキーフィールド(複数可)のための追加のGreaterThen条件(複数可)と$topパラメータを組み合わせなければならない:組み合わせ$top$skipパラメータを持つ

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

、Acumaticaは、常に最初の番号を要求します$topパラメータで指定されたレコードは、その後、結果セットの先頭から$skipパラメータで指定されたレコードの数を除外:

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

スキップパラメータは、SOAPでは使用できません。 SOAPでバッチでレコードをエクスポートするには、最後に取得したキーフィールド(複数可)についてGreaterThen条件(複数可)とのRowNumberプロパティのLessThan条件を組み合わせる必要があります。

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(); 
    } 
} 
+0

SOAPとかのう使用$スキップのですか? ありがとう –

+0

スキップパラメータはSOAPでは使用できません。詳細については上記の更新された回答をご覧ください。 – RuslanDev

+0

「RowNumber」のヒントありがとうございます!私は永遠に捜してきました。 –

関連する問題