2

Is there a way to force a documents computed fields to recalculate from within an Xpage, without saving the document?

I have a subform on a Notes database with many computed fields, these contain some complex calculations involving time range calculations. The database is used as both a web and client application. For the custom control containing the fields I don't want to have to recreate all the calculations, so have a computed text value bound to the computed form on the document.

On the subform as you tab through entering the information the computed fields are recalculated. On the custom control I have a refresh button which saves the datasource and does a partial refresh of the data entry section, but this can cause some errors or document save conflicts.

I will recreate the calculations if need be, but I just wondered if there is a slicker way of achieving this before I start that process?

4

2 回答 2

2

DominoDocumentData 对象具有 computeDocument() 和 doComputeDocument() 方法。我不确定他们在做什么。如果您在 Local\xsp 下查看 XPage / Custom Control 的类,您可以看到它们。使用数据源的变量名,例如 document1,您将能够获取 DominoDocumentData 对象并将它的大小写到该类。

于 2014-06-04T15:56:16.260 回答
2

没有“文档上的计算字段”之类的东西。一个文档完全不知道它的项目是如何获得它们的值的。计算字段存在于表单上。您有 2 个选项(您可以使用一个或两个)。

  • 定义 documentDatasource 时,您可以指定公式在加载和/或保存时执行。
  • 使用 NotesDocument 的 document.computeWithForm 方法
于 2014-06-04T16:01:35.920 回答