Inviewedit and dialog boxes

I have been looking on this discussion db for examples on how to make Inviewedit and dialob boxes, or date pickers work. There are several inferences that they should work, especially from Andre, but I cannot see how they work. If you use a Request type 1 (QUERY_REQUEST) to prompt for a dialog, and fill in the column value, when you then tab to the next field or use enter, the column value disppears when moving to Request type 2, 3 or 4. A WORKING code example would be great!!!

Thanks

Subject: Inviewedit and dialog boxes

That works even for creating documents in a view.Sub Inviewedit(Source As Notesuiview, Requesttype As Integer, Colprogname As Variant, Columnvalue As Variant, Continue As Variant)

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim caret As String



Set db = ws.CurrentDatabase.Database 

caret = Source.CaretNoteID

If caret = "0" Then Exit Sub

Set doc = db.GetDocumentByID(caret)

If doc Is Nothing Then Exit Sub



Select Case RequestType

Case 1:

	If doc.HasItem(Colprogname(0)) Then

		Columnvalue(0) = Doc.GetItemValue(Colprogname(0))

	Else

		Columnvalue(0) = ""

	End If

Case 2:

	continue = True

Case 3:

	For i = 0 To Ubound(Colprogname) Step 1

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

	Next

	Call doc.Save(True, True, True)

Case 4:

	Set doc = db.CreateDocument

	Doc.Form = "Test 1"

	For i = 0 To Ubound(Colprogname) Step 1

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

	Next

	Call doc.Save(True, True, True)

Case Else:

	

End Select

End Sub

Subject: RE: Inviewedit and dialog boxes

Sorry Christion - I still don’t get it here is what I have done so far - as you can see I have a dialog box, and I want to fill in the columnvalue with a value for the pick list

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

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim caret As String

Dim values() As String



Set db = ws.CurrentDatabase.Database

caret = Source.CaretNoteID

If caret = "0" Then Exit Sub

Set doc = db.GetDocumentByID(caret)

If doc Is Nothing Then Exit Sub



Select Case RequestType

Case 1:

	If doc.HasItem(Colprogname(0)) Then

		

		Redim Preserve values(3)

		values(0) = "Home"

		values(1) = "interState"

		values(2) = "International"

		values(3) = "unknown"

		Columnvalue(0)= ws.Prompt(PROMPT_OKCANCELLIST,"SELECT","Select a category","",values)

		'Columnvalue(0) = Doc.GetItemValue(Colprogname(0))

	Else

		Columnvalue(0) = ""

	End If

Case 2:

	continue = True

Case 3:

	For i = 0 To Ubound(Colprogname) Step 1

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

	Next

	Call doc.Save(True, True, True)

Case 4:

	Set doc = db.CreateDocument

	Doc.Form = "Test 1"

	For i = 0 To Ubound(Colprogname) Step 1

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

	Next

	Call doc.Save(True, True, True)

Case Else:

	

End Select

End Sub

Subject: RE: Inviewedit and dialog boxes

TerryI tried a few things but there is a problem I can not overcome until now. Requesttype VALIDATE_REQUEST runs before the field in the view is editable and SAVE_REQUEST after. What you would need ist to jump directily from the requesttype 1 to 3 without stopping. In the moment I can not see how to do this. I can use that dialogbox, but you have to activate that field first, chose the value, click OK AND press enter to put the value in the field.

That is not very good, but it works.

If that can help you, you find the code below:

By the way, I attended the Notes 6 upgrade course lately. We had exactly the same question and they did not know how to do this.

If you find a way around it, please post it.

When I have time again, I will also try to figure something out.

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

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim caret As String

Dim values(3) As String

Dim value As String

values(0) = "Home"

values(1) = "interState"

values(2) = "International"

values(3) = "unknown"

If RequestType = 1 Then

	value = ws.Prompt(PROMPT_OKCANCELLIST,"SELECT","Select a category","",values)

End If

Set db = ws.CurrentDatabase.Database 

caret = Source.CaretNoteID

If caret = "0" Then Exit Sub

Set doc = db.GetDocumentByID(caret)

If doc Is Nothing Then Exit Sub





Select Case RequestType

Case 1:

	If doc.HasItem(Colprogname(0)) Then

		Columnvalue(0) = Doc.GetItemValue(Colprogname(0))

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

	Else

		Columnvalue(0) = ""

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

	End If

	Call doc.Save(True, True, True)

Case 2:

	continue = True

Case 3:		

	For i = 0 To Ubound(Colprogname) Step 1			

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

	Next

	Call doc.Save(True, True, True)

Case 4:

	Set doc = db.CreateDocument

	Doc.Form = "Test 1"

	For i = 0 To Ubound(Colprogname) Step 1

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

	Next

	Call doc.Save(True, True, True)

Case Else:

	

End Select

End Sub

Subject: RE: Inviewedit and dialog boxes

Thanks ChristianAs usual, in the Notes world, the good ideas seem to be only half thought out. Lotus never seems to think that people will want use use these good techniques, other than the very simple obvious ways.

If we can make dialog boxes work, then inviewedit becomes a real alternative to using a form - date pickers, drop down lists who knows where it could go.

Anyway, if I ever find a solution, I will post it.

Thanks for your help

Subject: Inviewedit and dialog boxes -SOLUTION-

I know this is an old post, but i wanted to make sure anyone running across this would know that a solution does exist.

Here’s my sample code:

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

REM Define constants for request types

Const QUERY_REQUEST = 1

Const VALIDATE_REQUEST = 2

Const SAVE_REQUEST = 3

Const NEWENTRY_REQUEST = 4

REM Define variables

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim caret As String



REM Create Dialog Box for given column field

Dim values() As String

Dim value As String



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

	Redim values(5) As String	

	values(0) = "-DELETE-"

	values(1) = "Document Store"

	values(2) = "Discussion Database"

	values(3) = "Data Store"

	values(4) = "Process Support Database"

	values(5) = "Group Mail Box"		

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

End If

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

	Redim values(3) As String

	values(0) = "-DELETE-"

	values(1) = "Simple Database"

	values(2) = "Simple Workflow"

	values(3) = "Complex Workflow"

	value = ws.Prompt(PROMPT_OKCANCELLIST,"SELECT","Select a Category","",values)

End If

REM Get the CaretNoteID - exit if it does not point to 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)

If doc Is Nothing Then Exit Sub

REM Select the request type

Select Case RequestType

	

Case QUERY_REQUEST

REM Check value and save doc with new value if valid

	continue=False		

	If value = "" Then Exit Sub

	If value = "-DELETE-" Then value =""

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

	Call doc.Save(True, False)

	Call ws.ViewRefresh

	

Case VALIDATE_REQUEST

REM Validate Changes

Case SAVE_REQUEST

REM Write the edited column view entries back to the document

Case NEWENTRY_REQUEST

REM Create document and create “Form” item

End Select

End Sub

Subject: RE: Inviewedit and dialog boxes -SOLUTION-

Hi John,

The solution you posted works only, when you have only one editable column in the view. It fails when you have another editable column on the left and when you hit tab out from that column it launces the dialog box, after selecting value in the dialog box, the code sets the value in the document and refresh the view, followed by error message “Operation stopped at your request”.

Any thoughts ?

Regards,

Bilal

Subject: RE: Inviewedit and dialog boxes -SOLUTION-

Bilal,

I was using this in a view with multiple editable columns. Make sure you are using the programmatic name for the column and not the field name. In my example, it is setup for two columns; their programmatic names are “Category” and “Types”. You can add as many as you desire. We had had about seven if I remember correctly.

Good luck!

Subject: RE: Inviewedit and dialog boxes -SOLUTION-

I’ll just leave this here: Cool Thinking: How to make inviewedit more user friendly and useful