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 : QODBC & Filemaker - How do i get last inserted id in filemaker?Search Forum

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

 New Topic 
 
 Post Reply 
[1]  
 QODBC & Filemaker - How do i get last inserted id in filemaker? 
 Author   Message 
  james 
  
 Group: Members 
 Posts: 3 
 Joined: 2008-04-04 
 Profile
 Posted : 2008-04-04 16:15:55
i need to insert multiple invoice lines to QB but was unable to do so in filemaker. i need to get last inserted invoice id to insert the second invoice line item. i could get the txnID in the VBDemo. but, i do i get the last inserted id in filemaker script?

thank you very much! 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-04-07 11:25:58

First create the Invoice and then add invoice lines like this:

INSERT INTO "InvoiceLine" ("CustomerRefListID", "ClassRefListID", "RefNumber",
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache")
VALUES ('470001-1071525403', '30000-933272658', 'QODBCClass2', '250000-933272656',
'Building permit Additional Room', 100.00000, 100.00, '20000-999022286', 0)

Once the invoice is created, we can locate the TxnID using the QODBC stored procedure (as long as we haven't broken our QODBC connection):

SP_LASTINSERTID InvoiceLine

The TxnID for the new invoice is 5CA9-1197764583, so we can now add additional lines to the Invoice by doing:

INSERT INTO "InvoiceLine" ("TxnID", "ClassRefListID", 
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID")
VALUES ('5CA9-1197764583', '60000-933272658', '250000-933272656',
'Bin Permit Renovations', 200.00000, 200.00, '20000-999022286')

INSERT INTO "InvoiceLine" ("TxnID", "ClassRefListID",
"InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate",
"InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID")
VALUES ('5CA9-1197764583', '', '250000-933272656', 'Less Council Rebate',
-50.00000, -50.00, '20000-999022286')

The invoice now appears in QuickBooks with different Class values for each line:

 

  Top 
  james 
  
 Group: Members 
 Posts: 3 
 Joined: 2008-04-04 
 Profile
 Posted : 2008-04-10 04:00:25
Tom,

thank you very much for your reply. I know how to use the VBDemo 32 program to get the last inserted id. my problem is with filemaker. how do i get the last inserted id in filemaker?

thanks a lot,

James 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-04-10 07:30:33

You need to execute the same SQL Statements from within FileMaker.

SP_LASTINSERTID InvoiceLine

is simply a QODBC internal stored procedure SQL Statement that needs to be executed directly or via a pass-through query.

 

  Top 
  james 
  
 Group: Members 
 Posts: 3 
 Joined: 2008-04-04 
 Profile
 Posted : 2008-04-11 08:10:57

Tom,

thank for the reply. i know i need to execute that stored procedure..but how do i store the returned value in a variable in a filemaker script?

thanks,

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-04-11 09:26:10
Sorry, that question is something better directed to a Filemaker support forum or newsgroup, this is only a QODBC product support forum. 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to