1
votes

I have a notes document with fields. On this document I created a new field (call it Status) which has the following text value: QUEUED. Now If I get the document from the view by:

Set nvwQueuedOrderLines = dbCurrent.Getview("QueuedOrderLines")
Dim docOrderRegel As NotesDocument
Set docOrderRegel = nvwQueuedOrderLines.GetFirstDocument

And eventuelly get the data:

If docOrderRegel.Status(0) = "QUEUED" Then

...

Then when checking the items of docOrderRegel in the debugger i see no Status item/field.. But when right clicking the document properties in the document (in Lotus client) then I see the item/field Status with the value.. All other fields I can see in the debugger but just not this status field. What to do to get the field also in my docOrderRegel object.

2
Do you still see that field in properties when right clicking the CLOSED document from the view? If not then probably it will be a "computed for display" field...Lothar Mueller
Check the type of item the Status items is. If it RichText or Mime you might see the value in the properties box but getting at it is more workNewbs
@LotharMueller when document closed I can still see the property.YdB
The DataType is Text @NewbsYdB
hm - tricky. How many items do you see from that doc while being in Debugger? There's a stupid limit of items that can be shown in debugger ( I believe the limit is 256). Could that be the case? If not - just to be sure: can you build a test view and display the status field as a column value? Is that shown for the document in question?Lothar Mueller

2 Answers

4
votes

I assume that the field / item is there but you just don't see it in your debugger session.

As discussed via comments above: LotusScript debugger has a limit of how many items per document object can be shown. Apparently that limit is 256 items. Any item stored at an index position higher than 255 within the items array is not handled by the debugger.

One solution for you would be to add some temporary code similar to that:

Dim itemStatus as NotesItem
...
Set itemStatus = docOrderRegel.GetFirstItem("Status")

This way you create a dedicated NotesItem object drom your Status field making it independant from the described limitation. You then should be able to see the item's content in your debugger session.

3
votes

In Notes/Domino Form (=Design) and Document are different and (more or less) independent things.

Whenever you create a document, it takes the form AT THAT MOMENT and creates items for all fields that are on the form when the document is created.

The same happens when opening an existing document: It looks for the form and displays its data in the way it is designed there. New items for new fields are added on demand.

BUT: They are not SAVED to the document before you explicitly do that.

This process is pure frontend.

Notes NEVER changes existing documents automatically just because you changed something in the corresponding form (aka create a new Field "Status" with the value "QUEUED". That is why your script does not get the item (unless you open the document and the field in the form becomes an item).

There are different ways to update your documents with the changes you made to the form. The first one is: Open all documents in frontend and save them... But that is very time consuming.

You can update the documents using a Formula agent. Just select "None" as Target (this is important as we need to use @Commands and they do not work with any target) and put in the Formula:

@Command([ToolsRefreshSelectedDocs])

then select the documents to refresh and run the agent on them.

You can also use a LotusScript Agent. This one needs to run on selected documents:

Dim ses as New NotesSession
Dim db as NotesDatabase
Dim dc as NotesDocumentCollection
Dim doc as NotesDocument

Set db = ses.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument()
While not doc is Nothing
  Call doc.ComputeWithForm( False, False )
  Call doc.Save( True, true, True )
  Set doc = dc.GetNextDocument( doc )
Wend

Of course you can -instead of just refreshing all documents- add that code to your existing code:

Set nvwQueuedOrderLines = dbCurrent.Getview("QueuedOrderLines")
Dim docOrderRegel As NotesDocument
Set docOrderRegel = nvwQueuedOrderLines.GetFirstDocument

If not docOrderRegel.HasItem( "Status" ) then
  Call docOrderRegel.ComputeWithForm( False, False )
End If

If docOrderRegel.Status(0) = "QUEUED" Then