Agent not able to read a columns formula in a view

Hi guys,

I’m pretty sure this may be a simple problem. I have a WebQuerySave agent, in one of the sections of the script i am trying to read a column in a view. The column is populated by a formula. Below is the type of formula:

@If(G2BCom = “G2B”; “Yes”; G2BCom = “”; “No”; G2BCom)

i.e., if the G2BCom field = “G2B” then the cell displays Yes. If the G2BCom = “” then the cell displays No. This formula works fine.

My agent is trying to read this column. Here is my code:

Sub UpdateRecord(WindowsUserName As String)

Msgbox "Update Record - START"



Dim s As New notessession

Dim db As notesdatabase

Set db =s.currentdatabase

Set globalAppsRequest = db.getview("AllApplications")



Dim doc1 As notesdocument

Dim doc2 As notesdocument



Dim G2BfromView As String

On Error Resume Next



Set doc1= globalAppsRequest.getfirstdocument



Msgbox "G2B in View Yes/No 1 = " + doc1.G2BCom(0)



Do While Not (doc1 Is Nothing)

	Set doc2= globalAppsRequest.getnextdocument(doc1)



	If doc1.WindowsUserName(0) = WindowsUserName Then

		Msgbox "1.1.1"



	End If

	Set doc1=doc2

Loop



Msgbox "Update Record - FINISH"

End Sub

You can see the above ’ Msgbox “G2B in View Yes/No 1 = " + doc1.G2BCom(0)” ’ when i check the server, the doc1.G2BCom field (that should say Yes/No) is blank.

I thought something strange is going on so i set the MsgBox to output that value of a different field that isnt populated by a formlua. It worked perfectly.

Can anybody see what is wrong here??

Subject: Agent not able to read a columns formula in a view

I believe the document hasn’t been saved yet during the webquerysave. Try accessing the document via session.documentcontext

Subject: RE: Agent not able to read a columns formula in a view

Hello Brian,

That’s a bit better. The Msgbox now produces “G2B” when Yes and “” (or blank) when No.

However, what i wa after for the Msgbox to say either Yes or No.

Any ideas?

Subject: RE: Agent not able to read a columns formula in a view

Then you need to do in your LotusScript what your formula does in the view column.

Subject: RE: Agent not able to read a columns formula in a view

Oh yes, that’s one way of doing it.

Works as expected. Thank you Stan.

Are you able to provide an update to the thread you previously replied too?

http://www-10.lotus.com/ldd/nd6forum.nsf/ShowMyTopicsAllFlatweb/d9d39c24427a5e9e8525757100425136?OpenDocument