FieldGetText does not work in a view

Hi, I’m pretty new in Lotus Script and I would like to use .FieldGetText … This is working fine when the document is in read/edit mode… But in a view, when all doc are closed, what function I can use to read the data in a field ?

Thx in advance !

Subject: FieldGetText does not work in a view

I assume this is to go on an action button in the view.

  • Use NotesUIWorkspace.NotesUIView.Documents OR NotesSession.CurrentDatabase.UnprocessedDocuments to get the selected documents in the view (NotesDocumentCollection).

  • get the first document in the collection

  • use NotesDocument.GetItemValue( fldname )(0) or the shortcut notation NotesDocument.fldname(0) to get the value ( eg. doc.Value(0) )

Subject: FieldGetText does not work in a view

Hi,

this is from the Designer Help Database:

This view action totals the Amount items in the selected documents in the current view.

Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim total As Double
Set uiview = ws.CurrentView
Set dc = uiview.Documents
Set doc = dc.GetFirstDocument
While Not (doc Is Nothing)
If doc.HasItem (“Amount”) Then
total = total + Cdbl (doc.GetItemValue (“Amount”) (0))
End If
Set doc = dc.GetNextDocument (doc)
Wend
Messagebox total, “Total amount”
End Sub

Best regards
Mario Varchmin

Subject: Thx Everybody !

With all your help, it’s now working ! Thx !

Subject: all you do is…

put the name of the field in the bottom section of the view. There is no forumla needed. No Lotus Script. Just pick FIELD and slect the field. (i assume you are in design mode…)

Subject: Maybe this example will help.

From Help, GetFirstDocument Method

Dim db As New NotesDatabase( “Gaborone”, “todo.nsf” )

Dim view As NotesView

Dim doc As NotesDocument

Set view = db.GetView( “Open\By Project & Priority” )

Set doc = view.GetFirstDocument

If doc.HasItem(“Subject”) Then

While Not(doc Is Nothing)

Forall subject In doc.GetItemValue("Subject")

  Messagebox subject

End Forall

Set doc = view.GetNextDocument(doc)

Wend

End If

Subject: You are making this too difficult…

I think you are both over analyzing this… it’s a VIEW. you don’t need a FORMULA to grab a field. If you choose the Display type of FIELD… There is a LIST of fields at the bottom of the screen… you just select the field you want. DONE.

Subject: RE: You are making this too difficult…

No, you’re not understanding the question. Yes, if you just want to create a view and display the value in a column, your answer is correct. But the initial post said he needed to read a value off the document. This could be in an agent or an action button, where some code needs to be run on the selected document in a view. In that case, you would need to get a handle to the selected document and reference the field via NotesDocument.fieldName(0).

Don’t be so quick to be condescending - it may be you who is wrong…

Subject: Not condescending at all…

I understood the clarification from the post 2 hours before yours. I didn’t need it explained again, but thank you. And… I was not being condescending… I am one of the LEAST condescending people on here… I was trying to simplify things. Perhaps it is the color of eyeglasses you are wearing while reading… eyestrain can get to all of us.

Subject: RE: You are making this too difficult…

Oups, I think I did not explained it correctly. I’m not in designer. I’m in Notes client. A view is opened, and there is 1 document highlited. By running a lotus script, I want to read the content of a field sitting in that document. Without openning it.

I can do that by formula, but i MUST use script for what I need… Please help !Thx !!

Subject: FieldGetText does not work in a view

Oups, I think I did not explained it correctly. I’m not in designer. I’m in Notes client. A view is opened, and there is 1 document highlited. By running a lotus script, I want to read the content of a field sitting in that document. Without openning it.

I can do that by formula, but i MUST use script for what I need… Please help !Thx !!