Subject: SOLUTION: Open document to second tab
I didn’t say, but I wanted to do this in the Client, so those web posts suggested didn’t help me.
Unfortunately, I cannot get links and anchors working right, as in number 6 in this http://tinyurl.com/2g53y2 post, because of some wierd problem with EditDocument’s newInstance parm, http://tinyurl.com/25g49p. This is too bad since the anchors would let you scroll down the page, whereas this solution only lets you open to the right tab.
My solution is to use programmable tables and a separate field for tracking which tab to open.
First, you need an editable field named $. It must be editable, other types don’t seem to work.
But you can’t just value that field with the tab to reopen because if you use one of the buttons which reopens the document, then click Save, you get the Save warning. I don’t know why.
So you have to use another item – you don’t need a field – named OpenTab and use it to value $ in Queryopen.
Using OpenTab also allows you to reset the table to the first tab for the future.
Herewith, my solution:
$: Editable, hidden field
Sub Querysave
'If the user is saving the doc through the UI, reopen to first tab
Call Source.Document.ReplaceItemValue(“OpenTab”, “ProjectInfo”)
End Sub
Sub refreshDoc(doc As NotesDocument, uidoc As NotesUIDocument, dept As String)
'OpenTab is the tab to reopen to.
Call doc.ReplaceItemValue("OpenTab", dept)
Call doc.Save(True,True)
Call uidoc.FieldSetText("SaveOptions","0")
Call uidoc.Close()
Call ws.EditDocument(True, doc)
End Sub
Sub Queryopen
If thisdoc.OpenTab(0) = "ProjectInfo" Then
Call thisdoc.ReplaceItemValue("$ProjectTable", "ProjectInfo")
Else
Call thisdoc.ReplaceItemValue("$ProjectTable", "TeamInfo")
'Reset OpenTab in case user closes without saving to reopen to first tab.
Call thisdoc.ReplaceItemValue("OpenTab", "ProjectInfo")
Call thisdoc.Save(True, True)
End If
End Sub
Now, all I need to do is learn to scroll the document in Lotusscript. There are no editable fields on the page, so I can’t use NotesUIDocument.GotoField.