Scheduling DECS activity

This tip describes how to schedule DECS activity.

DECS (Domino enterprise connectivity services) is a real-time activity to push/pull data from external sources ie.,data on lotus and external source are always in sync at any given point of time. To achieve this, the DECS activities should be running non-stop. But there might be need to start the activity, pull/push data and stop the activity on a scheduled basis. Though there is a schedule feature in DECS, any updates to the documents prior to the start of the activity would not be pushed to the external source. The below code copied into a scheduled agent would overcome this problem. It starts the DECS activity, recalculates each documents (so push/pulls data to/from external source), and then stops the activity.


Dim session As New notessession
 Dim db As notesdatabase
 Dim decsdb As notesdatabase
 Dim acitivityview As notesview
 Dim activitydoc As notesdocument
 Dim doccoll As notesdocumentcollection
 Dim doc As notesdocument
 Dim query As String
 
 Set db=session.currentdatabase
 Set decsdb = 
session.getdatabase(db.server,"decsadm.nsf")
 Set activityview = decsdb.getview("(Nav Activities)")
 Set activitydoc = activityview.getfirstdocument
 
 'Start the activity
 If activitydoc.Type(0) = "Activity" Then
  If activitydoc.Lock(0)=0 Then
   activitydoc.RunASAP = 1
   Call activitydoc.save(True,True)
  End If
 End If
 
 query = {(select form="testForm"}
 
 'Refresh all documents, 
so that data is pulled/pushed to oracle
 Set doccoll = db.search(query,Nothing,0)
 
 If doccoll.count >  0 Then
  Set doc = doccoll.getfirstdocument
  While Not doc Is Nothing
   Call doc.computewithform(False,False)
   Call doc.save(True,True)
   Set doc = doccoll.getnextdocument(doc)
  Wend
 End If
 
 'Stop the activity
 If activitydoc.Type(0)="Activity" Then
  If activitydoc.Lock(0) <> 0 Then
   activitydoc.SystemAction = 21
  End If
  If activitydoc.RunASAP(0) <> 0 Then
   activitydoc.RunASAP = 0
  End If
  Call activitydoc.save(True,True)
 End If

Dig Deeper on LEI and DECS for Lotus Notes Domino

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close