Monday, January 25, 2010

#4: Bugs I found : Issues with lotusscript ComputeWithForm command

I sort of understand the "ComputeWithForm" command in the "NotesDocument" class as a command that refreshes a document in the back end.

It works most of the time, but for one scenario that I came across.And that is as follows

I have a view with say 1000 documents.
I am opening the form using which I have created those documents in the designer
And am adding a computed field with a @DBLookUp Formula
Then I am creating a new column on the view and mapping this computed field
Now I am creating an action button in the view and am coding the following into that,

 dim ws a new notesuiworkspace
 dim s as new notessession
 dim currDB as notesdatabase
 dim dc as notesdocumentcollection
 dim doc as notesdocument

 set currDB=s.currentdatabase
 set dc=currDB.unprocesseddocuments
 set doc=dc.getfirstdocument

 while not doc is nothing
  call doc.computewithform(true,false)
  call doc.save(true,false)
 wend

 call ws.currentview.refresh

So when I select a few document and click the action button I should see the newly added column showing the newly added computed field on the document. But No I dont see any values yet.

But when I open the document, edit the same, save and close it manually, I am able to see the differences on the view.

Yes doc.ComputeWithForm has failed in this scenario and the fix to this is to use @Command([ToolsRefreshAllDocs])

No comments:

Post a Comment