Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GoldMine GMCOMApi
Message
De
21/01/2004 10:52:16
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Produits tierce partie
Divers
Thread ID:
00868533
Message ID:
00869023
Vues:
23
Hi John.

>Has anyone successfully used this API to do anything. I'm having some real problems making it work correctly. I'm trying to grab contact info out of GoldMine via the GMCOMApi.dll.

Below is some code that works for me. Substitute the appropriate paths, user name, password, and SQL query.

Also note that you can use ODBC to access the GoldMine tables (either SQL passthrough or remote views).

Doug
* Instantiate the GoldMine COM API.

loGoldMine = createobject('GMCOMAPI.Application')
with loGoldMine

* Set properties needed for the login.

  .CommonFolder   = 'd:\program files\goldmine\common'
  .GoldMineFolder = 'd:\program files\goldmine\gmbase'
  .SystemFolder   = 'd:\program files\goldmine'
  .GMUserName     = 'DHENNIG'
  .GMPassword     = ''
  .Login()

* Do a query against CONTACT1, then logout.

  loValues = .NewContainer()
  loValues.Add('FldDlm', '~')
  lcQuery = [select contact, company from contact1 where zip like '2%']
  loValues.Add('SQL', lcQuery)
  .Execute('SQLStream', loValues)
  .Logout()

* Put the results into a cursor.

  lcResult = loValues.Item('Output').Item(1)
  lcResult = substr(lcResult, at(chr(10), lcResult) + 1)
  if not empty(lcResult)
    lnRows    = alines(laRecords, lcResult)
    lnFields  = occurs('~', laRecords[1])
    lnRecords = lnRows/lnFields
    create cursor CONTACT (CONTACT C(30), COMPANY C(40))
    dimension laRecord[lnFields]
    for lnI = 1 to lnRecords
      lcRecord = '~' + laRecords[lnI]
      for lnJ = 1 to lnFields
        laRecord[lnJ] = strextract(lcRecord, '~', '~', lnJ)
      next lnJ
      insert into CONTACT from array laRecord
    next lnI
    browse
  endif not empty(lcResult)
endwith
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform