Creating New Document agent

Hi

i m creating notes based application :

i have created forumala agent that will refresh the existing records but i want to create new recored for the same view

here is the code for refreshing already existing document

i means if view select the existing record and modifying it then it directely affects the view already existing this code is form action on:

@Command([OpenView];“FTName”;EmpName);

@Command([ToolsRefreshSelectedDocs]);

@Command([ViewRefreshFields]);

@Command([FileSave]);

@Command([FileCloseWindow]);

@All

now i want to if new employee is joined i want to refresh the view by new employee record

is there any help available:

is there any trick that directely adds new document: in the view

and the second problem is that this view refers the anothere form: not refering the existing form that user needs to enter record and update the record: is there any trick that i create lotusscript in queryclose by checking that isnewdoc or anyother trick in formula languge:

DEVs’’

Subject: RE: Creating New Document agent

Your question is difficult to understand. Please tell me whether I have understood you correctly.

Your database contains two types of documents, A and B.

When you edit an A document, you want to find the B document that has the same key value (EmpName) as the A document.

You want to refresh the computed fields on the B document, so that it has the latest information from the A document. I suppose the computed fields use @DbLookup that read information from the A document, using EmpName as a key.

When you save the A document, if there is not a B document with the same key, you will create a new B document. You don’t know how to do this.

I think the way you are updating the B document right now, with an action button, is wrong. You should use LotusScript code to do the update in the back end, so there is not “flashing” to alarm the user.

Use the PostSave event of the A form. You could do something like this:

Dim db As NotesDatabase

Dim docA As NotesDocument, docB As NotesDocument

Dim vuB As NotesView

Set docA = Source.Document

Set db = docA.ParentDatabase

Set vuB = db.GetView(“FTName”)

Set docB = vuB.GetDocumentByKey(docA.EmpName(0), True)

If docB Is Nothing Then

Set docB = db.CreateDocument()

docB.Form = “B”

docB.EmpName = docA.EmpName

End If

Call docB.ComputeWithForm()

Call docB.Save(True, True, True)