質問

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?

役に立ちましたか?

解決

DominoDocumentData object has computeDocument() and doComputeDocument() methods. I'm not sure what they do. If you look at the class for your XPage / Custom Control under Local\xsp you can see them. Using the variable name for your datasource, e.g. document1, you will be able to get a hold of the DominoDocumentData object and case it to that class.

他のヒント

There is no such thing as "computed fields on a document". A document is completely unaware how its items got their values. Computed fields live on forms. You have 2 options (you can use one or both).

  • when defining a documentDatasource you can specify that the formulas are executed on load and/or save.
  • use the document.computeWithForm method of the NotesDocument
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top