Q
Problem solve Get help with specific problems with your technologies, process and projects.

OLE reading cached values in Notes

We have a Visual Basic project accessing Notes via OLE. We use Notes classes in VB for accessing Notes form, modify and saving field values. A piece of VB code allows us to change a value field in a Notes form and save it. So before the change, the field has an OLDVALUE; after the change, it has a NEWVALUE. (We see the document field value directly in a view in the Notes database.)

In the same VB project, another piece of VB code reads the same form/field (using Notes classes). But the thing is: The field value reads=OLDVALUE! It seems the OLE call ...getodocumentByunid("...") in VB isn't physically reading the form in the database but is reading cached old values instead.

We've done a lot of debugging but can't find anything wrong in our code. Any suggestions?

View member feedback to this Ask the Expert Q&A.

You're exactly correct that Notes maintains a cache of NotesDocument objects in memory. Use the Delete statement to clear NotesDocument objects from the cache when you're done with them. That way, code that you execute later is assured of getting the latest document from the file, not a previously cached copy.

MEMBER FEEDBACK TO THIS ASK THE EXPERT Q&A:

I also face this problem, but I don't understand how to "Use the Delete statement to clear NotesDocument objects from the cache"; is it VB function or Notes function? If it's a VB function, would you mind to show a piece of VB code to show how to clear NotesDocument object?

—Ben C.

******************************************

Here's a good way to loop through a series of documents and prevent them from accumulating in the cache. This works exactly the same in LotusScript or VB.

Set docCur = view.GetFirstDocument( ) 
Do Until docCur Is Nothing 
        Set docNext = 
view.GetNextDocument(docCur) 
        ' process docCur here 
        Delete docCur        ' done with it
 -- remove from cache 
        Set docCur = docNext
Loop 

Andre Guirard

Do you have comments on this Ask the Expert question and response? Let us know.

Dig Deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchContentManagement

Close