Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Enterprise Integration Forum

Enterprise Integration Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext


Michael Sloan 19.Mar.08 09:50 AM a Web browser
Lotus Connectors Lotus Connectors - All Releases iSeries


Keep forgetting about this forum! This is the logical place to post this request. Any assistance appreciated.

I created an agent that will run in the evenings after the DB2 table is updated. At this stage, it just removes all documents and rebuilds new ones. Fortunately, a DB2 table was built with the exact information required. We used to have to do joins <et al> with the old agent. Utopia would be not removing all documents. That said... this is where my knowledge begins to narrow. I would like to check for changes then just update existing documents or create new docs if there are new entries in DB2. Here is my current script:

note: my current point of confusion is the "Nothing" and keylist part. It always needs to create/use all documents in this table.


On Error Goto ErrorHandler

'Declare Notes Objects

Dim nsession As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim count As Long
Dim sqlstring As String
Dim olddoc As NotesDocument
Dim olddoc2 As NotesDocument
Dim storedoc As NotesDocument

'Delete Documents

Set view = db.GetView("Stores")
Set olddoc = view.GetFirstDocument
While Not (olddoc Is Nothing)
Set olddoc2 = olddoc
Set olddoc = view.GetNextDocument(olddoc)
Call olddoc2.RemovePermanently(True)
Wend

'Declare LC Objects

Dim Session As New LCSession
Dim src As LCConnection
Dim FieldOut As New LCFieldList
Dim KeyList As New LCFieldList
Dim FLDCustomerNumber As LCField
Dim FLDClass As LCField
Dim FLDSubClass As LCField
Dim FLDStoreName As LCField
Dim FLDAddress1 As LCField
Dim FLDAddress2 As LCField
Dim FLDAddress3 As LCField
Dim FLDAddress4 As LCField
Dim FLDCity As LCField
Dim FLDState As LCField
Dim FLDZip As LCField
Dim FLDPhone As LCField
Dim FLDEmail As LCField
Dim FLDWeb As LCField
Dim xtbfld As LCField

‘Establishing the Connection to XTTB

Session.ClearStatus
Set src = New LCConnection ("db2")
src.Database = "DbName"
src.Metadata = "SAMPLE.XTTB"
src.UserID ="yyy"
src.Password = "zzz"
Print "Establishing Connection to XTTB"
src.Connect

Print "Connection to XTTB established"

'Create key fieldlist (all records in XTTB)

Set wtbfld = Nothing
xtbfld.Flags = LCFIELDF_KEY
xtbfld.value = xtbkey(0)

'No key select since custom table

count = src.Select(Nothing,1,fieldout)

'Set LC Fields

Set FLDCustomerNumber = Fieldout.Lookup ("XTBCUSN")
Set FLDClass = Fieldout.Lookup ("XTBCSCL")
Set FLDSubClass = Fieldout.Lookup ("XTBCSSC")
Set FLDStoreName = Fieldout.Lookup ("XTBCSNM")
Set FLDAddress1 = Fieldout.Lookup ("XTBADD1")
Set FLDAddress2 = Fieldout.Lookup ("XTBADD2")
Set FLDAddress3 = Fieldout.Lookup ("XTBADD3")
Set FLDAddress4 = Fieldout.Lookup ("XTBADD4")
Set FLDCity = Fieldout.Lookup ("XTBCITY")
Set FLDState = Fieldout.Lookup ("XTBSTAT")
Set FLDZip = Fieldout.Lookup ("XTBZIP")
Set FLDPhone = Fieldout.Lookup ("XTBPHON")
Set FLDEmail = Fieldout.Lookup ("XTBEML")
Set FLDWeb = Fieldout.Lookup ("XTBWEBA")

'Loop over XTTB Resultset

While (src.Fetch (Fieldout) > 0)

'Create Store Documents

Set storedoc = db.createdocument
storedoc.form= "Our Store"
storedoc.Customer_Number = FLDCustomerNumber.text(0)
storedoc.Class = FLDClass.text(0)
storedoc.SubClass = FLDSubClass.text(0)
storedoc.Store_Name = FLDStoreName.text(0)
storedoc.Store_Address = FLDAddress1.text(0)
storedoc.Store_Address2 = FLDAddress2.text(0)
storedoc.Store_Address3 = FLDAddress3.text(0)
storedoc.Store_Address4 = FLDAddress4.text(0)
storedoc.Store_City = FLDCity.text(0)
storedoc.State_Abb = FLDState.text(0)
storedoc.Store_Zip = FLDZip.text(0)
storedoc.Store_Phone = FLDPhone.text(0)
storedoc.Store_Email = FLDEmail.text(0)
storedoc.Store_Web = FLDWeb.text(0)

'Save Store Documents

Call storedoc.Save (True, False)
count = count +1
Wend

'Force Disconnect from DB2

src.Disconnect

'Error Handling

ErrorHandler:

If ( session.status <> LCSUCCESS) Then
Print session.GetstatusText, 0, _
+ "The following LC for DB2 error has occurred."
Else
Print Error$, 0, _
+ "The following LotusScript error has occurred."
End If

End Sub






LC for DB2 (Keylist & Nothing) (Michael Sloan 19.Mar.08)
. . RE: LC for DB2 (Keylist & Nothing) (Rami Jundi 19.Mar.08)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow