我编写了一个代理,该代理将测试列表中的每个字段是否为空。字段可以是每种类型,包括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:对不起,我英语不好,我是法语。
关于dom解析器错误。我的服务器上出现相同的错误。而且,我发现了两个有效的解决方案(大多数情况下)。
而不是测试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