Can't get field to refresh

I have the following agent which updates a field. My field properties are set for automatic refresh but although I close the document and database, reopen the field hasn’t been refreshed yet.

Any ideas how I might get this to refresh?

Thanks,

Sub Initialize

'GET A HANDLE ON THE NOTES SESSION

Dim s As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Set db = s.CurrentDatabase

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument



'GET A HANDLE ON THE CURRENT DATABASE

Dim targetDb As NotesDatabase

Set targetDb = s.CurrentDatabase



'IF THE ENVIRONMENTAL VARIABLE IS SET

Dim empNames As Variant

Dim delim As Variant

empNames = s.GetEnvironmentString("tmpvar")  

delim = ","



'DECLARE THE DOCUMENT THAT WILL BE CREATED



Dim targetDoc As NotesDocument

'DECLARE THE NOTESDATETIME OBJECT TO BE SET

Dim dateTime As NotesDateTime

'LOOP THROUGH THE VALUES (p) OF THE FIELD AND

'CREATE A DOCUMENT FOR EACH VALUE

Dim vPeople As Variant 

vPeople = Split(empNames, delim)

Forall p In vPeople

'CREATE THE TARGET DOCUMENT

	Set targetDoc = targetDb.CreateDocument

'IF THE TARGET DOC EXISTS, SET THE FIELD

'VALUES

	If Not (targetDoc Is Nothing) Then

		targetDoc.Form = "Acknowledgment"

		targetDoc.empName = p

		Set dateTime = New NotesDateTime(Format$(Now,"Long Date"))

		Call targetDoc.ReplaceItemValue("Date",dateTime)

'SAVE THE TARGET DOCUMENT

		Call targetDoc.Save( False, False ) 

		Call uidoc.Close

		

	End If

	

End Forall

End Sub

Subject: Can’t get field to refresh

I think the field is caching the data. Can anyone tell me what is wrong with this code?I’m receiving an error: the necessary external database

@Unique(@DbColumn(“NoCache”;“”:“”;“Acknowledgement Report”;1))

Subject: RE: Can’t get field to refresh

Use “”:“NoCache” or “Notes”:“NoCache” instead of just “NoCache”, and see also my comments about field type.

Subject: RE: Can’t get field to refresh

Where is this formula, and how is it related to the code in your initial post?

Subject: RE: Can’t get field to refresh

Your syntax is wrong.

Subject: Syntax - I don’t see it.

Sorry guys,I’ve made the requested changes and I’m not seeing the problem. Could be that I woke up before 4:00 AM this morning.

My Code:

@DbColumn(“Notes”:“NoCache”;“”:“”;“Acknowledgement Report”;1)

Example from Help:

@DbColumn( class : cache ; server : database ; view ; columnNumber )

The field is editable but still won’t refresh with computed or computed for display.

Subject: RE: Syntax - I don’t see it.

Are you still getting the error you referenced before?

Have you tried @DBColumn(“Notes”:“ReCache”…)?

ReCache is new with ND6 and forces it to refresh the cache.

And finally, where is this code? I don’t see it in your original listing, you posted it afterwards and I haven’t seen any indication of where this actually lives.

– Charles

Subject: Can’t get field to refresh

Angie,

What field has not been refreshed?

Subject: RE: Can’t get field to refresh

No, I’m not trying to set field values but I have a form used for display of information only. It basically does a lookup to the view which is correctly updated. It seems like the field is displaying cached info.

Field name: lkpacknowledged

@Unique(@DbColumn(“”;“”;“Acknowledgement Report”;1))

Subject: RE: Can’t get field to refresh

Ah. The agent isn’t involved at all. Or rather, it’s involved at a remove, but if your view looks OK, then the agent has done it’s part and done it successfully.

View refreshes are a problem when it comes to DBLookup and DBColumn, but if what you say is correct, that shouldn’t be the issue here. The important thing to check here is the field type for lkpacknowledged. What to do depends on what kind of field it is:

If it’s an editable or computed when composed field, it’s not going to change no matter what happens in the view. Change the type.

If it’s computed, you’ll have to open the document, get it into editing mode, and hit F9 to get it to refresh.

If it’s a computed for display field…well, I don’t know. That should work.

Subject: RE: Can’t get field to refresh

Angie,

  1. Why do you have a form used specifically just to display acknowdgement instead of just setting a flag on the original document?:

a. It keeps data together better; and

b. Provides an integrated audit trail.

AND THE BIGGIE:

  1. You did not specify “NoCache” in the DBColumn (which was left out of the original post as well).

Subject: Can’t get field to refresh

I have the following agent which updates a field.

No, it doesn’t. It creates a new document (targetDoc) and sets some field values there. If you’re trying to set a value on the currently open document, you’re aiming at the wrong place.

Subject: unrelated problems I see

unimportant: Whay are you declaring delim and result as variants when they’ll hod strings?

important: You’re closing the document that contains the name list INSIDE your forall loop; you should do that AFTER the loop.