Search code examples
quickbookswindev

Windev Quickbooks SDK OpenConnection2


I've been trying to find a way to connect my Windev application using the Quickbooks SDK. I wish to connect to my local QB instance using the qbXML API. I've been able to get a reference to the library using :

myconnection = new object Automation "QBXMLRP2.RequestProcessor"

However, when it comes to the OpenConnection2 method, I only get errors. Either "missing parameter" or "invalid parameter". I am aware that I should pass a "localQBD" type to the function, but I have not found out how to reference it. The following represents my invalid script.

myconnection>>OpenConnection2("","My Test App", localQBD)

How can I achieve a connection to QB through Windev?


Solution

  • After much searching, I have found that I was on the right path using the automation variable type. However, I have yet to find how to reference the constants provided by the library. Instead, I declare them beforehand like so

    CONSTANT
        omSingleUser = 0
        omMultiUser = 1
        omDontCare = 2
    
        qbStopOnError = 0
        qbContinueOnError = 1
    
        ctLocalQBD = 1
        ctLocalQBDLaunchUI = 3
    FIN
    

    Which gives us this working example

    myconnection = new object Automation "QBXMLRP2.RequestProcessor"
    ticket = myconnection>>BeginSession("",::omDontCare)
    XMLresponse = myconnection>>ProcessRequest(ticket,XMLrequest)
    myconnection>>EndSession(ticket)
    myconnection>>CloseConnection()
    delete myconnection
    

    A huge thanks goes to Frank Cazabon for showing me the proper constant values.