Create document if does not exist in a view

Hi,

I’m having problem on

form1 saved in View1 had field choices from View2, and have an option to add values not in list. How to add that value into view2 or create a document using scheduled agents?

View2 = Name1, Name2, Name3

Form1 field = Name1234

Name1234 must be added to View2

Thanks in advance

Subject: Create document if does not exist in a view

Have some LS code in the queryclose event of the form, where you check if this document has a new name not occuring in view2. If so create the document for view2.

You are sure that the documents in view2 are different documents than in view1? Otherwise you only have to refresh the view2.

Subject: RE: Create document if does not exist in a view

yeah, they have different forms… but it seems that its not creating when in loop… please refer below…

Dim . . .

.

.

.

set view = db.getview(“view1”)

set view2 = db.getview(“view2”)

set doc = view.getfirstdocument

set doc2 = view2.getfirstdocument

set doc3 = db.createdocument

while not (doc is nothing)

match = 0

while not (doc2 is nothing)

if doc.name(0) = doc2.name(0) then

  match = 1

  updatedetails

end if

set doc2 = view2.getnextdocument(doc2)

wend

if match = 0 then

doc3.Form = "view2 form"

call doc3.save(True, False)

end if

set doc = view.getnextdocument(doc)

wend

how will i able to make this work on multiple documents? I tried looking at it in lotusscript debugger and found nothing wrong at it, because when i tried to stop the debugger a document was created in view2. Any way to do this?