Saving field value on form

Hi,

I have database where I have populated a field in a form through Dblookup from one of the hidden view of the database. The populated value is seen on the form when I open it but I can’t get in the view as that value is not yet saved on the form.

Basically what I want to do is @command - open document in edit mode, do file save or cntrl S and save the document. I have to this for all the documents and there are around 2000 documents in the view. I tried couple of options but had not no luck.

Can anyone pls help. Thank you

Subject: Saving field value on form

Put this lotusscript code into an agent and run the agent manually from the agent list:

Dim db As NotesDatabase

Dim session As New NotesSession

Dim view As NotesView

Dim doc As NotesDocument



Set db = session.currentdatabase

Set view = db.GetView("ViewName")

Set doc = view.GetFirstDocument

If Not doc Is Nothing Then

	While Not doc Is Nothing

		If doc.computewithform(True, True) Then

			Call doc.save(True, True)

		End If

		Set doc = view.GetNextDocument(doc)

	Wend

End If

Subject: And if that does not work…

While Not doc Is Nothing		doc.YourField = Evaluate(|@DbLookup(""; ""; "View"; "| + doc.KeyField(0) + |"; 1)|, doc)

	Call doc.save(True, True)

	Set doc = view.GetNextDocument(doc)

Wend

Subject: RE: And if that does not work…

@Command([ToolsRefreshAllDocs])???

Subject: @Command([ToolsRefreshAllDocs])???

I used to use that all the time, but then started to find that it wasn’t working correctly. So, what am I doing wrong?

For example, I’ve added a computed field - “Test” to a form. The formula for Test is:

key := position;

lutype :=“Notes”:“NoCache”;

luview :=“EmpsPosLkp”;

assigned_emps := @DbLookup(lutype;“”;luview;key;“employee”;[FailSilent]);

“[IS Admin]”:assigned_emps

The agent is set to run from the Action menu with a target of none. I go to the view with the existing documents, run the agent, look at the document properties, field list, and there is no field called Test. The documents’ modified date shows the agent has run on them, but no new field.

Subject: RE: Saving field value on form

Thank you so much for all the responses. I tried Rellim’s code and it worked perfect. This forum is really a blessing…thaks