Question

Referencing the following IPP Documentation:

https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/query_filters

I made the assumption that the following code using the Linq Extentions Projection would alter the request and reduce the payload of the response by only querying for the requested fields and only including those fields (narrow result set) in the response:

public List<ShortAccount> GetFullShortAccountList(bool logRequestResponse)
{
    var accounts = new List<ShortAccount>();        
    var accountQueryService = new QueryService<Account>
                                 (GetIppServiceContext(logRequestResponse));
    var selected = accountQueryService.Select(a => new { a.Id, a.Name });
    foreach (var account in selected)
    {
        accounts.Add(new ShortAccount { Id = account.Id, Name = account.Name });
    }
    return accounts;
}

Now the behavior of this method is as expected, but if I look at the request/response logs (or the actual request and response using Fiddler) the request doesn't change -- it is still "Select * from Account", and the response still includes all the other properties in the Account entity.

In other words, the payload is not reduced one iota.

Am I doing something wrong here? Or do I just understand this incorrectly?

How can I use the SDK to generate a query that would look more like "Select Id, Name from Account", and only return that result set?

Related question -- if this mode of query filtering does not reduce the payload, what is its purpose? You might as well get the whole shebang and just take the fields you need?

Thanks in advance.

Was it helpful?

Solution

That's right @Barrick. The implementation of our query providers is not exactly the same as the standard LINQ. So, Stephan, that's the issue.

If you just want to get specific fields I would suggest you to use IDSQuery like:

QueryService<Account> AccQueryService22 = new QueryService<Account>(context);
var t13 = AccQueryService22.ExecuteIdsQuery("Select Id, Name From Account Where Active in (true, false)");

I will forward the feedback to our team.

Thanks!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top