문제

I'm using version 2.1.12.0 of the IPP .Net Dev Kit, and having a problem where when I use ExecuteQuery to return a list of all of the customers for a QBD instance, it will only return the first 500.

In the IPP documentation, it talks about using the ChunkSize and StartPage, but the .net library only allows you to specify the ChunkSize.

Is there a way to make ExecuteQuery return more than 500 records when using this version of the .net library?

var cq = new CustomerQuery() { ActiveOnly = true };
var results = cq.ExecuteQuery<Ipp.Customer>(context);

// results will never contain more than 500.
도움이 되었습니까?

해결책

I found a solution to the problem, the IPP .net SDK does let you specify the IteratorId. It turns out the Item property on the CustomerQuery/QueryBase represents the IteratorId XML field. If you don't specify the Item/IteratorId, then calling ExecuteQuery will always return the first 500 results.

Working code sample below:

        var cq = new CustomerQuery() { ActiveOnly = true };

        // this fills in the IteratorId that is documented on the IPP website
        // if you leave this out, the loop below will run infinitely if there 
        // are >= 500 records returned.
        cq.Item = Guid.NewGuid().ToString("N");

        ReadOnlyCollection<Ipp.Customer> cqr = null;

        do
        {
            cqr = cq.ExecuteQuery<Ipp.Customer>(context);

            // do something with the results returned here.
        }
        while (cqr.Count == 500);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top