About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide
SametimeBookCoverImage.jpg

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide
SametimeAdminBookCoverImage.jpg

Purchase on Amazon

MiscLinks

Visitor Count...



View My Stats

« End of Service (EOS) of Lotus Notes and Domino 5.x | Main| Well, that sucks! Our car was broken into last night... »

Is it Possible to Refresh Documents Using LotusScript ?

Category Software Development

Interesting little tidbit from the Knowledgebase...

Is it Possible to Refresh Documents Using LotusScript ?

Document Number:  1092630

Problem
Is there a LotusScript function equivalent to the following @Formula functions:

@Command[ToolsRefreshAllDocs]
@Command[ToolsRefreshSelectedDocs])

The ComputeWithForm method (of the NotesDocument class) does not recalculate fields.

Content
In most cases, the ComputeWithForm method (of the NotesDocument class) can be used to refresh documents.  This method is actually designed to trigger a field's Default Value, Input Translation and Input Validation formulas, but it also does trigger Computed formulas as well.

The ComputeWithForm method is not suitable for refreshing forms which have a Computed field which refers to itself.  This is because the ComputeWithForm method recalculates the document twice, which would cause undesirable results in such a field formula.

For example, consider a form with a Computed Numeric field called Count, and the formula for this field is "Count+1".  If the Count field had a value of 1 before the ComputeWithForm method was called, then afterwards the Count field would have a resulting value of 3.

For cases where a field's formula references itself, there are two ways to workaround this limitation:

  • Refresh the document using either @Command[ToolsRefreshSelectedDocs] or @Command[ToolsRefreshAllDocs].
  • Perform the formula calculation for the field in the LotusScript agent itself.

For example, to increment a Numeric field named Count:

doc.count=doc.count(0)+1
Call doc.save(True, True)

Comments

Gravatar Image1 - and I've done the same thing on occasion myself...

Gravatar Image2 - this one wound up bugging me in an agent i wrote about 3 years ago. the agent rolls through all the person docs in the domino dicrectory.

if the person doc's http password has any value in it, we move on to the next doc. when we find a blank http password, we go out via odbc to a sql server database pull in the first 6 digits of the user's password, and populate the http password field with that.

problem being, the password would be left as clear text, ie, no hash applied. computewithform didn't help.

instead of banging my head forerver on it, we just went with a refresh all docs agent as a follow up to the password agent.

Gravatar Image3 - Emoticon

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)

Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.

Thanks!

Thomas "Duffbert" Duff

Ads of Relevance...