如何测试ui文档中是否存在字段或隐藏有关它的Notes错误消息

问题描述 投票:0回答:2

我编写了一个代理,该代理将测试列表中的每个字段是否为空。字段可以是每种类型,包括RichText。富文本字段可以包含文本或附件。该代理必须在UIDocument上运行,因为如果必填字段为空,则不允许用户保存。

我们有一个现有的代理,但有时会(每天5到6次)返回错误“ 4602:L'opérationDOM Parser aéchoué”(我认为它应该类似于“操作DOM Parser失败”)。行:

Call DXLExporter.process

我在Internet上发现这是服务器问题,我没有帮助。我发现一些令人困扰的东西来替换现有代理:

' source is the NotesUIDocument, send to the agent in parameter
' champSource is a string : the name of the field

On Error GoTo ErrorHandler

Call source.GoToField(ChampSource)
Call source.SelectAll
Call source.DeselectAll

Exit Function
ErrorHandler:
    Select Case Err
        Case 4407 ' empty field
            Print "champ vide : " & ChampSource
        Case 4412 ' non-existent field
            Print "champ non trouvé : " & ChampSource
        Case Else
                Print LSI_Info(2) & " - " & Error & " - " & Err & " - " & Erl
        End Select
    Exit Function

并且它起作用,如果字段为空,“ source.DeselectAll”会生成错误4407,如果包含任何内容,则不会产生错误。

问题是,这是具有“隐藏时间”字段的表单。当测试了该字段之一时,如果它是隐藏的,我会在此行中看到Notes弹出窗口“ Impossible de localiser ce champ”(应该是英文的“不可能找到该字段”):

Call source.GoToField(ChampSource)

并且仅在此弹出窗口之后,脚本才会转到ErrorHandler。

我尝试在之前添加一个条件:

If source.Document.HasItem(ChampSource) Then
    Call source.GoToField(ChampSource)
    Call source.SelectAll
    Call source.DeselectAll
End If

但是该项目存在于文档中,尽管该字段在ui文档中不存在。

我正在寻找一种解决方案来隐藏Notes弹出窗口,并让我的ErrorHandler进行工作或测试ui文档中是否存在该字段。

提前感谢您的回答。

PS:对不起,我英语不好,我是法语。

lotusscript lotus
2个回答
0
投票

关于dom解析器错误。我的服务器上出现相同的错误。而且,我发现了两个有效的解决方案(大多数情况下)。

  1. 重试几次。就是说如果错误4602,然后再试一次。将最大重试次数设置为10-20次。我仍然看到这种方法的错误,但不像以前那样频繁。
  2. 不验证。将DOM解析器上的InputValidationOption设置为VALIDATE_NEVER。

https://www.ibm.com/support/knowledgecenter/SSVRGU_8.5.3/com.ibm.designer.domino.main.doc/H_INPUTVALIDATIONOPTION_PROPERTY_IMPORTER.html


0
投票

而不是测试source.Document.HasItem(ChampSource),实际上您需要做的是查看表单并确定隐藏时间的公式。然后,您可以编写如下代码:

if Evaluate("The hide-when-formula goes here", source.Document) = true then
   ' the field is hidden; so do what you want for that case
else
    Call source.GoToField(ChampSource)
    Call source.SelectAll
    Call source.DeselectAll
end if
© www.soinside.com 2019 - 2024. All rights reserved.