Update a field in View

Dear Guys

I have a Lotus View having 200 documents. I want to search a particulare document based on key field in the view and want to update fields of that document without opening that view.

Can anyone help by giving code.

Subject: Update a field in View

this code is used in the inviewedit event- and comes from courseware from waresource.com (which I am not a part of- but do teach from their material - the view property create a new column at view level needs to be checked and column property editable column needs to be checked. The columns edited are “ProductName”, “Price” & “QtyOnHand”

For a lot more info- check out their stuff.

Const QUERY_REQUEST = 1

Const VALID_REQUEST = 2

Const SAVE_REQUEST = 3

Const NEWENTRY_REQUEST = 4



' These constants represent the programmatic names of the three edit-in-place columns

Const PRODUCT = "ProductName"

Const PRICE = "Price"

Const QTY = "QtyOnHand"



Dim ws As New notesuiworkspace

Dim note As NotesDocument

Dim item As NotesItem

Dim db As NotesDatabase

Dim returnValue As Variant



Continue = False  'will reset later if successful



Set db = ws.currentdatabase.database



If Not (source.Caretnoteid) = "0" Then

	Set note = db.GetDocumentByID(source.caretnoteid)

Else

	Set note = New Notesdocument(db)

End If



If (note Is Nothing) Then Exit Sub

If note.IsResponse Then Exit Sub ' Responses can't be modified in the view



Select Case RequestType

Case QUERY_REQUEST: ' Edit the column

	Continue = True

	Goto NOSAVE

Case VALID_REQUEST: ' Validate the column edit

	Continue = True

	Goto NOSAVE

Case SAVE_REQUEST: ' Save the column edit

	For index = 0 To Ubound(ColProgName)			

		Select Case ColProgName(index)						

		Case PRODUCT:				

			note.ProductName =ColumnValue(index)				

		Case PRICE:				

			If Isnumeric(Columnvalue(index)) Then

				note.Price = Val(Columnvalue(index))

			End If				

		Case QTY:

			If Isnumeric(Columnvalue(index)) Then

				note.QtyOnHand = Val(Columnvalue(index))

			End If				

		End Select  ' ColProgName(index)			

	Next  ' ColProgName(index)

	Goto SAVE

Case NEWENTRY_REQUEST:	

	Set note = db.CreateDocument()

	note.Publish = "1"

	note.Form = "Product"

	For index = 0 To Ubound(ColProgName)			

		Select Case ColProgName(index)						

		Case PRODUCT:				

			note.ProductName =ColumnValue(index)				

		Case PRICE:				

			If Isnumeric(Columnvalue(index)) Then

				note.Price = Val(Columnvalue(index))

			End If				

		Case QTY:

			If Isnumeric(Columnvalue(index)) Then

				note.QtyOnHand = Val(Columnvalue(index))

			End If				

		End Select  ' ColProgName(index)			

	Next  ' ColProgName(index)			

	Goto SAVE

End Select

SAVE:

Call note.save(True, True, True)		

Call ws.viewrefresh

NOSAVE:

End Sub

Subject: RE: Update a field in View

Can you please provide any simple example. Which can search a particular document in view e.g by Emp No and update Name of that employee.

Subject: RE: Update a field in View

Judging from your answer, I think your original question was misleading.

"I have a Lotus View having 200 documents. I want to search a particulare document based on key field in the view and want to update fields of that document without opening that view. "

You want to update fields in a document without opening a view? That’s the normal way Notes operates. You make changes to documents (which hold the data) and those changes are reflected in views (which only display data found in documents).

Should this happen in the Notes client or web browser? Where does the key come from? Should the user type in the key or is it all back-end code? Please try to tell us a little more about what you want to do, and possibly how and why.

Subject: RE: Update a field in View

I almost think that he meant “without opening the document” rather than “without opening the view” and yes, that can be achieved by operating on the back-end.

Subject: RE: Update a field in View

Right, and that might lead to InviewEdit, indeed, but the search by key part doesn’t seem to fit, then.

Subject: Clarification of question.

I have 100 employee records in Lotus having quota of leave with form Name Quota.

An another form is used to send leave application read quota from Quota form and subtract the remaining quota in Form name Quota according to the days for which leave submitted.

So I have two forms Quota and Leave. I want to read Quota in Leave Form from Quota Form for a particular employee and then wants to adjust remaining Quota in Quota form of that employee.

Subject: RE: Clarification of question.

So I hope that you have a key field (possibly generated using @unique) that is shared between the two related documents.

Typically, this kind of processing would be done by taking the request for leave and compare it against documents in available leave. If the request for leave has the employee’s ID (@unqiue), then it should be a trivial matter to look up the related document in the view of employee leave available view, as long as that view is keyed on the same @unique values found in the request documents. Then just update via back-end (doc, not uidoc). Note that the ID running the code must have rights to update the leave available documents - perhaps the normal user making the request does not have such rights so the server must do it on their behalf using a scheduled agent, or something like that.

Subject: Update a field in View

Hiif your looking for browser . then visit the following link

http://www.dominodesigner.com/ddhome/dhome.nsf/Embedded-Edit-View-Form!OpenForm

if ur looking for notes then “Thomas H. Snelh” post