HomeRecipesAPI ReferenceChangelogDiscussions
Log In
Discussions

Discussions

Ask a Question
Back to All

Count and FirstResultIndex issue.

Hi,

I have been designing the bulk load of WorkOrders into our system and am having trouble understanding the behavior of the 'Count' and 'FirstResultIndex' properties.

I am making a request to https://az-am-ent-f3.corrigo.com/api/v1/query/Workorder using the following body:

{"QueryExpression":  
 {  
    "Criteria":{  
       "Conditions":[  

            {  
            "PropertyName": "ActionLogRecords.ActionDate",  
              "Operator": "GreaterOrEqual",  
               "Values": ["2025-02-19 00:00:00.000"]  
           },  
           {  
            "PropertyName": "WorkZone.Asset.Id",  
              "Operator": "In",  
               "Values": [797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842]  
           }
],
   "FilterOperator": "And"
 },
 "Distinct": true,
 "PropertySet": { "Properties" : ["*", "WorkOrderCost.Id", "Priority.*","RequestorContact.Id", "MainAsset.Name", "MainAsset.ModelId", "MainAsset.ParentId","MainAsset.Id", "MainAsset.IsOffline","WorkZone.DisplayAs", "WorkZone.Asset.Id", "WorkZone.Portfolios.Id", "SubType.DisplayAs" , "SubType.Id","SubType.ConcurrencyId", "Specialty.DisplayAs", "Specialty.WONServiceId", "Specialty.Instructions", "Specialty.Id","Specialty.ConcurrencyId", "RepairCode.*", "Employee.Id", "VendorNte.CurrencyTypeId", "VendorNte.Value", "Procedures.WorkOrderId", "Procedures.ProcedureTemplate.DisplayAs", "Procedures.Asset.Name", "Procedures.Asset.Id", "Procedures.Id","WorkOrderCost.CostsTotal.Value","WorkOrderCost.ExpensesTotal.Value","WorkOrderCost.PaymentAmount.Value", "WorkOrderCost.VendorInvoiceTotal.Value","WorkOrderCost.SERVICEFEESTOTAL.VALUE", "WorkZone.Number","WorkZone.Portfolios.PortfolioId", "Procedures.StatusId", "ActionLogRecords.Id", "ActionLogRecords.ActionDate", "ActionLogRecords.Comment", "ActionLogRecords.TypeId"]},
 "Count": 2000,
 "FirstResultIndex": 0
 }
}

Here’s what I’m observing in the responses:

When I send the request with 'FirstResultIndex' = 0 and 'Count' = 2000, I receive 150 records in the response.
When I set 'FirstResultIndex' = 150, I expected to receive an empty response, but instead, I get 97 records.
When I change 'Count' = 200 and 'FirstResultIndex' = 0, I receive 68 records.
I’m unsure what the expected number of records in the response should be and how to correctly use these properties, particularly in cases where there are more than 4000 elements in the response.

Could you clarify how these properties work and the best way to handle pagination for large responses?

Thank you for your help!