1

我正在开发一个在框架集中打开文档的 Domino 客户端应用程序。

当我单击保存按钮时,它会进行一些莲花脚本验证,添加到历史字段等,然后最后进行保存:

Sub Click(Source As Button) Dim validate1 As Validation Dim As New NotesUIworkspace Dim s As New NotesSession
Dim uidoc As NotesUIDocument Dim approverNames As String Dim workflow1 As Workflow
Dim name1 As String Dim names1 As String Dim item1 As NotesItem Dim history1 As History

Set uidoc = ws.CurrentDocument
Call uidoc.refresh  

'===============================================
'Validation
'===============================================
Set validate1 = New Validation()

Call validate1.checkCustomer(uidoc.FieldGetText("Customer"))
Call validate1.checkEndUser(uidoc.FieldGetText("EndUser"))
Call validate1.checkShortProjectDescription(uidoc.FieldGetText("ShortProjectDescription"))
Call validate1.checkProjectName(uidoc.FieldGetText("ProjectName"))
Call validate1.checkProjectLocation(uidoc.FieldGetText("ProjectLocation"))
Call validate1.checkOperationCenter(uidoc.FieldGetText("BusinessUnit"))
Call validate1.checkSalesCenter(uidoc.FieldGetText("SalesCenter"))
Call validate1.checkMarketSegment(uidoc.FieldGetText("MarketSegment"))  
Call validate1.checkSAPDate(uidoc.FieldGetText("SAPDate"))
Call validate1.checkRevision(uidoc.FieldGetText("Revision"))
Call validate1.checkValidityDate(uidoc.FieldGetText("ValidityDate"))
Call validate1.checkDateApproval(uidoc.FieldGetText("DateApproval"))
Call validate1.checkCurrencyUSD(uidoc.FieldGetText("CurrencyUSD"))
Call validate1.checkMargin(uidoc.FieldGetText("Margin"))

If validate1.displayErrorMessages() = 0 Then
'========================================================================
    Call uidoc.FieldSetText("WhoHasApproved","")
    Call uidoc.FieldSetText("ApproversNotified","")     

    Call uidoc.FieldSetText("SubmitDate",Cstr(Now))
    Call uidoc.FieldSetText("Status","In Process")

    'Add calls to workflow here....
    Set workflow1 = New workflow("SAPFCD")

    'Update History Field - Submitted for Processing by
    Set history1 = New History(uidoc.Document)
    Call history1.addTo("Submitted for Processing", uidoc.FieldGetText("CreatedBy"))    
    Set item1 = uidoc.Document.ReplaceItemValue("History" , history1.getDescription())

    'Set ApproverList
    names1 = workflow1.setApproverList(uidoc)
    Call uidoc.FieldSetText("ApproverList",names1)

    uidoc.Refresh

    name1 = workflow1.setNextApprover(uidoc)        
    Call uidoc.FieldSetText("NextApprover", name1)
'========================================================================   

    'Add calls to workflow here....
    Call uidoc.FieldSetText("Status","1st Peer")

    uidoc.Save
    uidoc.Close(True)
    uidoc.Close(True)
End If

结束子

然后继续关闭整个数据库并将用户返回到工作区。

我想要的是保存文档,然后将用户返回到框架集中的指定页面。

我试图将这样的代码添加到 QuerySave 事件中,但不起作用:

Sub Queryclose(Source As Notesuidocument, Continue As Variant) Dim ws As New NotesUIworkspace
ws.OpenFrameSet("MainFrame") ws.SetTargetFrame("Main")
ws.OpenPage("Saved") End Sub

关于如何在不关闭整个数据库的情况下保存/关闭框架集中的 UI 文档的任何想法。

德里克

4

2 回答 2

1

您在框架集的框架内打开文档的任何具体原因?
通常你有一个大纲和视图的框架集,并且在它们自己的选项卡/窗口上打开文档,这样当你运行的代码只关闭文档时。

**更新做了一些更多的测试,你可以在 uidoc.save 之后插入它并删除 uidoc.close

Call ws.SetTargetFrame("your frame name here") 
Call ws.ComposeDocument("","","your form name here",,,False)

我忘了提到你应该在退出应用程序时将目标框架设置回“”,如果你不这样做,当其他应用程序尝试打开框架集时用户可能会出错。

于 2009-06-11T13:38:24.863 回答
0

如果您只包含一个 uidoc.close 事件而不是您显示的两个事件,它应该可以正常工作。

还要确保没有任何表单事件 PostSave/PostClose 或 QuerySave/QueryClose 调用关闭事件。

于 2009-06-10T21:24:14.813 回答