Manage Learn to apply best practices and optimize your operations.

Creating New Docs Based on Outside Data

This agent initially retrieves data from an outside source and creates new documents by comparing two sets of fields between every data record and every document in a particular view. This agent will traverse all the document in the view and every record in the data source to see if new information exists. A simple counter was inserted to keep track of existing documents. If the counter is equal to zero then a new Document is created and the data source is inserted.

 Do 'Traverses every record in data set Set view = db.getview("All Tracking Documents") Set doc = view.GetFirstDocument DocCount = 0 While Not ( doc Is Nothing ) 'Traverses every doc in view DocCustomerSequence = doc.GetItemValue("Field1") DocContactSequence = doc.GetItemValue("Field2") CustomerSequence = result.GetValue("OutsideSource1") ContactSequence = result.GetValue("OutsideSource2") If CustomerSequence = DocCustomerSequence(0) Then If ContactSequence = DocContactSequence(0) Then DocCount = DocCount + 1 'Keeps track of existing docs End If End If Set doc = view.GetNextDocument(doc) Wend If DocCount = 0 Then 'Creates new doc Set doc = New NotesDocument( db ) doc.form = "NewDocument" Out1 = result.GetValue("OutsideSource1") Out2 = result.GetValue("OutsideSource2") Set item = doc.ReplaceItemValue("Field1",Cstr(Out1)) Set item = doc.ReplaceItemValue("Field2",Cstr(Out2)) Call doc.Save( True, True ) End If Call result.NextRow() Loop Until result.isendofdata

Dig Deeper on Domino Resources - Part 3

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