Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sample XAPI script

Status
Not open for further replies.

troyddaniels

Programmer
Jan 11, 2007
28
US
I am looking into writing some VB programs that will do some routine functions in order to save us some lanpak licenses. We have 5 IAP licenses that are just sitting dormant.

I have no clue how to use XAPI. Can anyone supply me with some sample script of a program that opens a session, accesses a database, does ANYTHING and then closes the session? Or even some basics?

Thanks much appreciated.
 
Search for xAPI on this forum for some examples.

You can also record a macro to get the basic code you need. You will just need to switch the COMAPI references to xAPI references.

zemp
 
Another XAPI question...

Like I said, XAPI is completely new to me and I don't have much reference material, I searched the forums but didn't find anything that really helped. Basically my code is as follows for opening a session (and maybe I'm going about this whole thing wronge, feel free to correct me please.).

Dim session As ACCPACXAPILib.xapiSession
Set session = CreateObject("ACCPAC.xapiSession")
session.Init "", "GL", "GL1000", "53A"
session.Open "ADMIN", "ADMIN", "AFKCOM", Date, 0
session.OpenDBLink DBLINK_COMPANY, DBLINK_FLG_READWRITE
Set DBLink = session.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

I'm not sure what the XAPI equivelent is for session.Init, session.open, and so forth. Basically right now I'm just trying to figure out how to access a specific database. Anyone help please?

Thanks
 
The xAPI does not use a 'dblink' object. There are just two lines to open session and then you declare and open the views.

Open Session
Code:
Dim m_Sess As ACCPACXAPILib.xapiSession

Set m_Sess = CreateObject("ACCPAC.xapisession")
m_Sess.Open "ADMIN", "ADMIN", "SAMINC", Date, 0
The first "ADMIN" is the user name and the second is the password. The exact database ID required can be found in 'common services/company profile' in the DAtabase ID field. 'Date' is the built in VB function to return the current system date.

To open a view just record a macro and copy the view declarations and compositions. Just remember to change the COMAPI references to xAPI references.

When working witrh the views you will have to make sure that you are using xAPI methods and properties. But a macro is a very good place to start. Check your VB object browser for more information.


zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top