Manage Learn to apply best practices and optimize your operations.

The ComputeWithForm Method

The ComputeWithForm Method can be very useful

You Can View User Feedback To This Tip

The ComputeWithForm Method has been around for a quite a while and can be very useful. However, I've often had the need to compute just a field or two on a very complex form, and this can cause problems in workflow if the entire form isn't filled out yet and validation somewhere else on the form might fail.

For example, sometimes appending text into a multi-value computed field requires the field to be recomputed before Notes can recognize it as an array. A simple solution is to create a VERY basic form with just the fields that you want to re-compute. Switch forms in your code, call the ComputeWithForm method and switch the form back. This method returns a flag which you can then check to see if the compute was successful. If computeSuccess is = True, then there are no errors on the document and the fields passed validation. If not, you could go into some type of error handling routine.

Keep in mind this will not work if there is a form stored in the document. For this method Notes determines the form for the document by:

1. The stored form, if any
2. The contents of the Form item
3. The database default form, if there is not a Form item

Check the Help documention for this method for explanations on the method parameters.

Get a handle ndoc on your document

ndoc.form = 'ComputeFormName'
Call, False)
computeSuccess = ndoc.ComputeWithForm(False, False)
ndoc.form = 'OriginalFormName'
Call, False)


  • In his development tip titled, The ComputeWithForm Method, Timothy Neyman gives a technique that uses ComputeWithForm after substituting a different, shorter form, to avoid recalculating all fields.

    However, the code sample shows the form being saved twice. Any time you've saved by computing with a short form is going to be more than used up by saving the document a second time. Therefore, the tip doesn't meet its stated goal.

    It's not necessary to save the document before calling ComputeWithForm.

    Note: ComputeWithForm is slow whether you have a complex form. If you really want to improve performance, forget using ComputeWithForm. Instead, individually calculate the required new field values in your LotusScript code.

    ndoc.form = 'ComputeFormName'
    ' DON'T Call, False)
    computeSuccess = ndoc.ComputeWithForm(False, False)
    ndoc.form = 'OriginalFormName'
    Call, False)— Andre Guirard

Dig Deeper on Domino Resources - Part 4

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...