Open naeazach opened 9 years ago
My hunch is that startDate.ToStrjng() doesn't produce the same string as your first example.
You can watch this with tracing.
@ScottCate
On Wednesday, November 11, 2015, naeazach notifications@github.com wrote:
So when I run the untyped query:
var queryData = new XmlRpcStruct() { { "DateCreated", "2015-11-03%" } }; var cs = client.DataService.Query( table: "Invoice", limit: 1000, page: 0, queryData: queryData, selectedFields: new[] { "AffiliateId", "ContactId", "CreditStatus", "DateCreated", "Description" }).ToList();
it returns records. But when I run the same thing as: var results = client.DataService.Query( page: new DataPage(1000, i), queryBuilder: q => q.Add(c => c.DateCreated, startDate), fieldSelection: z => z.Include(c=> c.AffiliateId) .Include(c=> c.ContactId) .Include(c=> c.CreditStatus) .Include(c=> c.DateCreated) .Include(c=> c.Description) .Include(c=> c.Id) .Include(c=> c.InvoiceTotal) .Include(c=> c.InvoiceType) .Include(c=> c.JobId) .Include(c=> c.LeadAffiliateId) .Include(c=> c.PayPlanStatus) .Include(c=> c.PayStatus) .Include(c=> c.ProductSold) .Include(c=> c.PromoCode) .Include(c=> c.RefundStatus) .Include(c=> c.Synced) .Include(c=> c.TotalDue) .Include(c=> c.TotalPaid)
);
I get no results. Any ideas?
— Reply to this email directly or view it on GitHub https://github.com/EventDay/Infusionsoft.net/issues/40.
@ScottCate (Mobile) 602-418-0770
That's what I figured, I know that even if you do .Date it'll still show 12:00:00 ... however, the query builder expects a real date value if passing it in as part of date query. is there a place I can add an exception to trim the time in the query builder? I couldn't find exactly where it's putting together the xmlrpcstruct...
@naeazach I just ran into the same issue and got around it by exposing the Dictionary property through IQueryBuilder:
Dictionary<string, object> Dictionary { get; }
This allows me to get around the type restriction when bulding the query:
queryBuilder: q => { q.Dictionary.Add("LastUpdated", "2016-02-16%"); },
Perhaps not the most eloquent solution, but got the job done.
I couldn't get it to work either. Intellisense has trouble with the line:
queryBuilder: q => q.Add(c => c.DateCreated, startDate),
Everything else appears to be fine in the .Query(). In my case I am using a ContactAction object, but the actual ContactAction object does not seem to be available in the queryBuilder for use in a lambda expression.
This is unfortunate because I was really hoping to hydrate a ContactAction instead of using the untyped query method.
So when I run the untyped query:
works
but this doesnt:
I get no results. Any ideas?