Ineditview AND create document from seleted doc

Hi All,

I serached the forum but didn’t find much help about to how to create the new document from selected document in same view using the NEWENTRY_REQUEST event.

What I need is create a new document and gets the few fields values from selected document.

Thanks for help

Lisa

Subject: ineditview AND create document from seleted doc .

create a view action button to compose the new document and on the form enable the property to inherit values from selected document, read up on it in designer help.

Subject: I want to create document using NEWENTRY_REQUEST event

Subject: RE: I want to create document using NEWENTRY_REQUEST event

where is this event located (where is it triggered from)?

Subject: RE: I want to create document using NEWENTRY_REQUEST event

I want to select a document from view and in theNEWENTRY_REQUEST event, I need a document created with the values from the selected document.

Following is code I am using…

Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant, Continue As Variant)

%REM

This view has two editable columns: one Text and one Numeric.

The programmatic name of each editable column

is the same as the name of the field whose value it holds,

but the processing for each column is different.

%END REM

REM Define constants for request types

Const QUERY_REQUEST = 1

Const VALIDATE_REQUEST = 2

Const SAVE_REQUEST = 3

Const NEWENTRY_REQUEST = 4



REM On Error Goto Errhandle

REM Define variables

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim caret As String

REM Get the CaretNoteID - exit if it does not point at a document

caret = Source.CaretNoteID

If caret = "0" Then Exit Sub

REM Get the current database and document

Set db = Source.View.Parent

Set doc = db.GetDocumentByID(caret)



Dim value As String



If RequestType = QUERY_REQUEST  And ColProgName(0) = "Vendor_Information" Then

	

	Dim luReturn As Variant

	

	luReturn = Evaluate(|@Unique(@DbColumn( ""; @Subset(@DbName;1):@GetProfileField("PortalDBPaths";"KAMPath"); "(TenantSettingsByProjectLease)";1))|, doc)

	value = ws.Prompt(PROMPT_OKCANCELLIST,"SELECT","Select a Type","",luReturn)

End If

REM Select the request type

Select Case Requesttype

	

Case QUERY_REQUEST

	

	If value = "" Then Exit Sub

	continue=False	

	Call doc.ReplaceItemValue(Colprogname(0), value)

	Call doc.Save(True, False)

	Call ws.ViewRefresh

	

	

Case VALIDATE_REQUEST

REM Cause validation error if user tries to exit column with no value

	If Fulltrim(Columnvalue(0)) = "" Then

		Messagebox "You must enter a value",, "No value in column"

		Continue = False

	End If

	

Case SAVE_REQUEST

	

 REM Write the edited column view entries back to the document

	For i = 0 To Ubound(Colprogname) Step 1

		Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))

	Next

REM Save(force, createResponse, markRead)

	Call doc.Save(True, True, True)

	

Case NEWENTRY_REQUEST

REM Create document and create “Form” item

REM Write column values to the new document

	Set doc = New NotesDocument(db)

	Call doc.ReplaceItemValue("Form", "ContractSummary")

	For i = 0 To Ubound(Colprogname) Step 1

		Call doc.ReplaceItemValue(Colprogname(i), Columnvalue(i))

	Next

REM Save(force, createResponse, markRead)

	Call doc.Save(True, True, True)

	

End Select

End Sub

Subject: RE: I want to create document using NEWENTRY_REQUEST event

Well it looks as though you are following the designer help example pretty closely. Not sure what furhter you need to happen but the ony data that will get written to the new doc from the selected doc are the values that appear in the view’s columns. If you need other field values inherited then you have to populate them programatically.

Subject: RE: I want to create document using NEWENTRY_REQUEST event

Paul,I just want to inherit first 3 fiels values from the selected document.

Thanks for help

Subject: RE: I want to create document using NEWENTRY_REQUEST event

Lisa - an interesting way to do this is to have one of your EDITABLE columns be DISPLAY AS ICON.When clicked, the column only goes thru the SAVE_REQUEST event in the INVIEWEDIT - and shows no funky display changes to the users.

You can then use the SAVE_Request event to Add your new document - (you will have a handle to the SELECTED doc in the INVIEWEDIT event)… Try it!

…s