Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Selecting updated balances only for querySearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v7 Forum

 New Topic 
 
 Post Reply 
[1]  
 Selecting updated balances only for query 
 Author   Message 
  Alex E 
  
 Group: Members 
 Posts: 16 
 Joined: 2007-01-31 
 Profile
 Posted : 2007-09-14 02:49:54

Hello - I am using QODBC desktop read write 2007 v 7.10.00.231.  I have set up an ODBC connection and am using a third party tool to extract balances from the Customer:List table and write them to our CRM application (Goldmine). 

For efficiency, I only want to select balances updated since the last time the process ran. I set up a query to pull records where Customer.TimeModified is greater than the last process rundatetime.  However, this doesn't appear to capture records with updated balances.  It looks like changes in balance don't put any timestamp on the customer record.

Is there a table and field I can use to determine when the customer's balance was last updated, or another method I can apply? I see there is a combination table Sales, but cannot tell if this could be used to identify only the changed records.   Thanks for any help you can provide.

 

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-09-14 09:32:04

The Sales table includes only invoices, credit memos and sales receipts information. Balances can also be changed by payments. So you're going to have to do something like this:

For Invoices, Credit Memos and Sales Receipts Modified from the Start of Today (Current System Date) 

Select Sales.CustomerRefFullName, max(Customer.Balance) as "NewBalance"
from Sales unoptimized, Customer unoptimized
where Sales.CustomerRefListID=Customer.ListID
and Sales.TimeModified >= {fn TIMESTAMPADD(SQL_TSI_YEAR, 0, {fn CURDATE()})}
group by Sales.CustomerRefFullName

And for Payments Modified from the Start of Today (Current System Date) 

Select ReceivePayment.CustomerRefFullName, max(Customer.Balance) as "NewBalance"
from ReceivePayment unoptimized, Customer unoptimized
where ReceivePayment.CustomerRefListID=Customer.ListID
and ReceivePayment.TimeModified >= {fn TIMESTAMPADD(SQL_TSI_YEAR, 0, {fn CURDATE()})}
group by ReceivePayment.CustomerRefFullName

 

  Top 
  Alex E 
  
 Group: Members 
 Posts: 16 
 Joined: 2007-01-31 
 Profile
 Posted : 2007-09-15 00:04:40
Thank you.  After I run these separate queries, do I then need a third to select the most recent balance in cases where customers have activity in both the Sales and ReceivePayment tables   - i.e select for those where Sales.CustomerRefListId=ReceivePayment.CustomerReflListId, and if they exist then pick the NewBalance from the record where TimeModified is most recent? 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-09-16 18:01:15
No, the open balances will be the same (unless a payment was made after the first query). Simply feed both of the query results into Goldmine. 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to