Refreshing data agent

First, I’ve been researching this on various forums and have tried a lot of the suggestions and haven’t gotten any to work. My issue, I’m importing data into my NAB from a CSV file via a PERL Script using LDAP calls. Works well except for one issue. The fields that have data added need to be refreshed. I’ve tried the Computewithforms, doesn’t work. The only thinh I have found to work is the @Command([ToolsRefreshAllDocs]) run manually. I need it to run on a scheduled basis. Here’s one try at the refresh:Sub Initialize

Dim s As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim History As String

Dim ws As New NotesUIWorkspace

Set db = s.CurrentDatabase

Set view = db.GetView("ESAT") 

Set doc = view.GetFirstDocument



While Not (doc Is Nothing)

	x = x + 1 

	Print "Now Updating Document # " + Str(x) ' Prints the document Number that is being updated

	returnFlag = doc.ComputeWithForm(True,False)

	If (returnFlag) Then

					Call doc.Save(True,True)

		Call ws.ViewRefresh

	End If

	Set doc = view.GetNextDocument(doc)

Wend

End Sub

This doesn’t work, it runs nicely but doesn’t update the fields. The indication is when a doc is put in edt mode and then try to close w/o making changes, you are prompted about saving changes. If you do save the changes the fields are refreshed. So, if there is a way to open selected docs in EDIT mode and then closed and saved that would be alright too(?)

Subject: Refreshing data agent

Unfortunately, this is a problem when updating NAB or calendar entries (as well as imported resource reservations). What I found I had to do was run an agent to set the values of the computed fields and not use compute with form. This was especially important in the resource reservation template because compute with form would fail because validation would fail.

A pain I know…

Subject: RE: Refreshing data agent

As in SetField? Example maybe? Sorry for my inexperience…

Subject: RE: Refreshing data agent

However you are poplating the data, with either formula language or lotusscript. The key is that computewithform has to do with validation and little else (others have disagree with me on this point in the forum, but that has been my experience, especially with fields that rely on lookups).

If you look at the text of the help file, it says:

“Validates a document by executing the default value, translation, and validation formulas, if any are defined in the document form.”

Notice it mentions nothing that relates to computed fields.

Here is what you can do. Do your import and go to the import view. Highlight a document, but do not open it. Then select File > Document Propoerties.

Take a Screen shot of each part of the dialog box as it displays and save it in a single image file. Then open the document, edit it and save it. repeat the document properties screenshots as above. Then compare the two sets of screenshots. This will tell you what has not been updated and/or is missing.

You can then modify your process to accomodate this. It may seem like a lot of extra hoops, but it will definietly help you understand the structure and interactions of the form.

Subject: RE: Refreshing data agent

Doing as you suggested , comparing the two docs properties, IS how I know what needs to happen. How it happens is what I’m asking. I have been trying various things and have gotten the @Command([ToolsRefreshAllDocs]) to do what is needed- but, I need to schedule an agent to do this, so @Command([ToolsRefreshAllDocs]) won’t be available. I need a lotuscript equivalant to that @Command. If you know of what would work it would be appreciated.

Subject: RE: Refreshing data agent

I guess I was answering your question in a round about way. There is no script equivalent to @Command([ToolsRefreshAllDocs]) as this happens in the UI not in the back end. You have to see what has not been set and set those values by script so that you do NOT have to open and save each document or run the Manual @Command([ToolsRefreshAllDocs]).

Subject: RE: Refreshing data agent

What File Save is saying is that you need to programmatically (manually) reproduce the same calculations that the form uses to set the values of the computed fields in an agent that you run after your LDAP import.

Subject: RE: Refreshing data agent

Right, that’s my problem as I tried to state from the beginning, what I need is some help to get a solution. Again, I have tried many of the suggestions I found on here (like the code I posted in the beginning) but I still have the issue. The fields are test fields and they need to be refreshed. Opening the document into EDIT mode and saving , manually, does the trick. So does @Command([ToolsRefreshAllDocs]) but I need to run an agent on a scheduled basis.

Subject: RE: Refreshing data agent

At the risk of being short and curt (ok I already am vertically challenged), you have been told what is not possible and what you need to do to mimic it. Short of writing your code for you, I am not sure what I or others could offer?

Subject: RE: Refreshing data agent

So you’re a short guy, eh? This wasn’t in your soul-searching mini-bio earlier; the details continue to mount.

Subject: RE: Refreshing data agent

Is the Modified date of the documents changing and it’s just that the fields are not updated correctly? If the Modified date does not reflect the fact that the documents have been saved, then maybe returnFlag is false for some reason.

If (returnFlag) Then

Call doc.Save(True,True)

Call ws.ViewRefresh

End If

Do you know that the doc.save line is actually running? I would put a print statement in to display the value of returnFlag.