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
|
|
Insert Invoice line help! |
Author |
Message |
|
Posted : 2006-07-20 08:17:25 |
Here is my insert statement, Attribute1 and 2 are being passed through shipping application.
insert into InvoiceLine ( RefNumber, InvoiceLineAmount, InvoiceLineType, InvoiceLineDesc, CustomerRefListID, CustomerRefFullName ) values ( '$CustomerShipmentId$', $ShippingCharge$, 'DHL Freight', '$ShipmentDetails/Pieces/Piece/AirwayBillNumber$', '$Attributes/Attribute01$', '$Attributes/Attribute02$' )
Error is: "ERROR [00000] [QODBC] Error parsing complete XML return string."
I think looking at the quickbooks schema has fried my brain, do you see what I am doing wrong in my statement?? Thanks! -Sarah |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-07-20 08:46:29 |
The order of the columns in the INSERT statement needs to be in the same order as the InvoiceLine table. Use either CustomerRefListID or CustomerRefFullName, not both.
You can use the SP_COLUMNS tablename stored procedure command in VB Demo to get the EXACT order of the columns and the table schema rules for the QuickBooks Company file you have open. The last few columns have Queryable, Updateable, Insertable, Required_On_Insert and the format ie:-
sp_columns InvoiceLine
See: How do I create Invoices? for more. |
|
|
|
|
Posted : 2006-07-20 09:16:20 |
Here is what I came up with after putting the statement in order as suggested:
insert into InvoiceLine ( CustomerRefListID, InvoiceLineType, InvoiceLineDesc, InvoiceLineRate ) values ( '$CustomerShipmentId$', 'Freight', '$ShipmentDetails/Pieces/Piece/AirwayBillNumber$', $ShippingCharge$ )
And the error :
ERROR [42000] [QODBC] Expected lexical element not found: <identifier>
Any more advice? Thanks Tom! |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-07-20 10:16:08 |
Your INSERT should follow the following format:
INSERT INTO "InvoiceLine" ("CustomerRefListID", "RefNumber", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate", "InvoiceLineAmount", "InvoiceLineSalesTaxCodeRefListID", "FQSaveToCache") VALUES ('470001-1071525403', 'Test104', '250000-933272656', 'Package SubTotal', 12.37, 12.37, '20000-999022286', 0) |
|
|
|
|
Posted : 2006-07-20 10:29:04 |
Then this Insert should work!
insert into "InvoiceLine" ( "CustomerRefListID", "InvoiceLineType", "InvoiceLineDesc", "InvoiceLineRate" ) values ( '$CustomerShipmentId$', 'Freight', '$ShipmentDetails/Pieces/Piece/AirwayBillNumber$', $ShippingCharge$ )
But I still get the Lexical element error message... What is wrong with my statement? |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-07-20 11:31:19 |
No, you're are also still missing a InvoiceLineItemRefListID. Most likely your $ShippingCharge$ is a string variable, not a decimal.
INSERT INTO "InvoiceLine" ("CustomerRefListID", "InvoiceLineType", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate") VALUES ('470001-1071525403', 'Item', '250000-933272656', 'Package SubTotal', 12.37)
Otherwise you will also get a: "Error 3180: There was an error when saving a Invoice. QuickBooks error message: You have no items or one or more of your amounts is not associated with an item. Please enter an item." message. |
|
|
|
|
Posted : 2006-07-20 11:52:44 |
Here I am now -
insert into "InvoiceLine" ( "CustomerRefListID", "InvoiceLineType", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate" ) values ( '$CustomerShipmentId$', 'Freight', '250000-933272656', '$ShipmentDetails/Pieces/Piece/AirwayBillNumber$', '$ShippingCharge$' )
The error - ERROR [42S00] [QODBC] Invalid operand for operator: <assignment>
-Sarah |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-07-20 14:12:32 |
Please use VB Demo and manual value entries to sort out your syntax. Don't use InvoiceLineType, you should only be doing:-
INSERT INTO "InvoiceLine" ("CustomerRefListID", "InvoiceLineItemRefListID", "InvoiceLineDesc", "InvoiceLineRate") VALUES ('470001-1071525403', '250000-933272656', 'Package SubTotal', 12.37)
Where (in my example): InvoiceLineItemRefListID is '250000-933272656' and found like this:
Select ListId, FullName from Item where FullName like 'P%'
See: How do I use the VB Demo for testing? |
|
|
|
|